title: Doctrine 2.1 - Call to undefined method + MyMethod(Proxy)?
body: <p>I have two classes:</p>
  
  <p><strong>News</strong>:</p>
  
  <pre><code>/** @Entity @Table(name="news") */
  class News {
      /**
       * @Id @GeneratedValue @Column(type="integer")
       * @var integer
       */
      protected $id;
  
      /**
       * @Column(type="string", length=100)
       * @var string
       */
      protected $title;
  
      /**
       * @Column(type="text")
       * @var string
       */
      protected $content;
  
      /**
       * @ManyToOne(targetEntity="User", inversedBy="news")
       * @JoinColumn(referencedColumnName="id")
       */ 
      protected $author;
  
      /**
       * @ManyToOne(targetEntity="NewsCategory", inversedBy="news")
       * @JoinColumn(referencedColumnName="id")
       */ 
      protected $category;
  
      /**
       * @Column(type="datetime")
       */
      protected $add_date;
  
      # CATEGORY methods
      public function setCategory($val) { if($val instanceof NewsCategory) $this-&gt;category = $val; }
      public function getCategory() { return $this-&gt;category; }
  }
  </code></pre>
  
  <p><strong>NewsCategory</strong>:</p>
  
  <pre><code>/** @Entity @Table(name="news_category") */
  class NewsCategory {
      /**
       * @Id @GeneratedValue @Column(type="integer")
       * @var integer
       */
      protected $id;
  
      /**
       * @Column(type="string", length=50, unique=TRUE)
       * @var string
       */
      protected $name;
  
      /**
       * @OneToMany(targetEntity="News", mappedBy="category")
       */
      protected $news;    
  
      public function __construct() {
          $this-&gt;news = new \Doctrine\Common\Collections\ArrayCollection;
      }
  
      public function setName($name) { $this-&gt;name = $name; }
      public function getName() { return $this-&gt;name; }
  
      public function getNews() { return $this-&gt;news; }
  }
  </code></pre>
  
  <p>I want to download one news with this query:</p>
  
  <pre><code>$q = $this-&gt;db-&gt;createQuery("SELECT n FROM News n WHERE n.id = :id");
  $q-&gt;setParameter('id', $_GET['id']);
  $news = $q-&gt;getResult();
  </code></pre>
  
  <p>And next, I want to get id of a Category related to this news with</p>
  
  <pre><code>$news-&gt;getCategory()-&gt;getId()
  </code></pre>
  
  <p>With code above, I'm getting this error:</p>
  
  <pre><code>Fatal error: Call to undefined method DoctrineProxies\NewsCategoryProxy::getId() in C:\[...]\newsController.php on line 61
  </code></pre>
  
  <p>What's wrong? Why my <code>NewsCategory</code> class can't see <code>getId()</code> method?</p>