title: Symfony2: Call to a member function getId() on a non-object even though there is an object?
body: <p>I keep getting this error:</p>
  
  <pre><code>    /* ... */
      $em = $this-&gt;getDoctrine()-&gt;getEntityManager();
      $movie = $em-&gt;getRepository('MyMyBundle:Movie')-&gt;findMovieByName('moviename'); // Repository Class
      \Doctrine\Common\Util\Debug::dump($movie); // dumps the object just fine! The Repository found it
      echo $movie-&gt;getId(); // brings me the error nevertheless
  </code></pre>
  
  <p>Fatal error: Call to a member function getId() on a non-object in ... on line ...</p>
  
  <p>I have the getId() method in my Entity. Other methods also don't work even though it <strong><em>is</em></strong> and object!</p>
  
  <p>The object gets dumped like: </p>
  
  <pre><code>..... array(1) { [0]=&gt; object(stdClass)#759 (59) { ["__CLASS__"]=&gt; string( .....
  </code></pre>
  
  <p>Any hints?</p>