title: Doctrine2 - OneToMany/ManyToOne Bidirectional not working
body: <p>Hi everyone and thanks for help, </p>
  
  <p>I'm currently dealing with a problem while I want to make an OneToMany/ManyToOne Bidirectional Relationship with Doctrine2 (&amp; Symfony2). </p>
  
  <p>Here are my two classes : User (which extends FOSUser) and collection which represents a collection of videos. 
  Of course, a user can have several collections, but a collection is only related to one user. </p>
  
  <pre><code>/* COLLECTION */
  namespace Com\ComBundle\Entity;
  
  use Doctrine\ORM\Mapping as ORM;
  use Symfony\Component\Validator\Constraints as Assert;
  
  
  /**
   * Com\ComBundle\Entity\Collection
   *
   * @ORM\Table(name="collection")
   * @ORM\HasLifecycleCallbacks
   */
  class Collection
  {
      /**
       * @var integer $id
       *
       * @ORM\Column(name="id", type="integer")
       * @ORM\Id
       * @ORM\GeneratedValue(strategy="AUTO")
       */
      private $id;
  
      /**
       * @ORM\ManyToOne(targetEntity="Com\UserBundle\Entity\User", inversedBy="collections")
       * @ORM\JoinColumn(nullable=false)
       */
      private $user;
  
      /**
       * Set user
       *
       * @param Com\UserBundle\Entity\User $user
       * @return Collection
       */
      public function setUser(\Com\UserBundle\Entity\User $user) {
          $this-&gt;user = $user;
          return $this;
      }
  
      /**
       * Get user
       *
       * @return Com\UserBundle\Entity\User User 
       */
      public function getUser() {
          return $this-&gt;user;
      }
  
  }
  </code></pre>
  
  <p>And user,</p>
  
  <pre><code>    /* USER */    
  namespace Com\UserBundle\Entity;
  
  use FOS\UserBundle\Entity\User as BaseUser;
  use Doctrine\ORM\Mapping as ORM;
  use Symfony\Component\Validator\Constraints as Assert;
  
  
  /**
   * @ORM\Entity
   * @ORM\Table(name="user")
   */
  class User extends BaseUser
  {
      /**
       * @ORM\Id
       * @ORM\Column(type="integer")
       * @ORM\GeneratedValue(strategy="AUTO")
       */
      protected $id;
  
      /* 
       * @ORM\OneToMany(targetEntity="Com\ComBundle\Entity\Collection", mappedBy="user")
       */
      private $collections;
  
  
      public function __construct()
      {
          parent::__construct();
          $this-&gt;collections = \Doctrine\Common\Collections\ArrayCollection();
      }       
  }
  </code></pre>
  
  <p>When I use the doctrine:generate:entities command, it does not generate the methods relative to $collections (get/add/remove), and even if I wrote it myself, it does not work. 
  getCollections() return NULL for example. </p>
  
  <p>What am I missing in this code ?</p>