title: Doctrine 2 Mapping One-to-Many / Many-to-One
body: <p>I'm converting my application from doctrine1 to doctrine2.4
  i did automate mapping from database and I'm missing some relations:</p>
  
  <p>Table : Products
  productid,title ,price</p>
  
  <p>Table : LocationProducts
  id , productid , loctionid , qty</p>
  
  <p>so each LocationProducts row have 1 product, each product can be on few locations</p>
  
  <p>on mapping under the locationproducts class i got :</p>
  
  <pre><code> /**
   * @var \Products
   *
   * @ORM\ManyToOne(targetEntity="Products")
   * @ORM\JoinColumns({
   *   @ORM\JoinColumn(name="productid", referencedColumnName="productid")
   * })
   */
  private $productid;
  </code></pre>
  
  <p>and under product Model i don't have the relationship , i have tried to add it but its fails : its says productid mapping is already exists</p>
  
  <p>this is my target query :</p>
  
  <pre><code>$qb = $em-&gt;createQueryBuilder()
      -&gt;select('p.productid,lp.qty AS totalqty')
      -&gt;from('Products','p')
      -&gt;innerJoin('p.LocationProducts','lp')
      -&gt;setFirstResult( $offset )
      -&gt;setMaxResults( $limit )
      //getDQL
      -&gt;getQuery();
  </code></pre>
  
  <p>and its returns the error:</p>
  
  <pre><code>Class Products has no association named LocationProducts
  </code></pre>
  
  <p>What am i missing ?
  thanks.</p>