title: Error: Call to a member function getAuthor() on a non-object
body: <p>Am using symfony2 and doctrine2. When I try to recover the Author property from the Article entity using method getAutho(), it throws this error:  </p>
  
  <pre><code>FatalErrorException: Error: Call to a member function getAuthor() on a non-object in D:\xampp\htdocs\Portofolio\src\Portofolio\FrontBundle\Controller\FrontController.php line 65  
  </code></pre>
  
  <p>This is my function:  </p>
  
  <pre><code>public function showAction($slug) {
      $em = $this-&gt;getDoctrine()-&gt;getManager();
      //retrieve the the article using it's id
      $article = $em-&gt;getRepository('PortofolioAdminBundle:Article')-&gt;getArticleBySlug($slug);
      var_dump($article-&gt;getAuthor());
      //get About entity
      $about = $em-&gt;getRepository('PortofolioAdminBundle:About')-&gt;findOneBy(array('email' =&gt; 'baccouch.taieb@gmail.com'));
      //get all categories
      $categories = $em-&gt;getRepository('PortofolioAdminBundle:Category')-&gt;findAll();
      $articles = $em-&gt;getRepository('PortofolioAdminBundle:Article')-&gt;getLatestArticles();
      //create the search form
      $search = new Search();
      $searchForm = $this-&gt;createForm(new SearchType(), $search);
      return $this-&gt;render('PortofolioFrontBundle:Front:show.html.twig', array(
                  'article' =&gt; $article, 'about' =&gt; $about, 'categories' =&gt; $categories,
                  'articles' =&gt; $articles, 'searchForm' =&gt; $searchForm-&gt;createView(),
      ));
  }  
  </code></pre>
  
  <p>How can I fix this error?</p>