title: Doctrine Class "..\.." has no association named "..."
body: <p>I hope you can help me with this problem because I really cannot see what is wrong here.</p>
  
  <p>I have 2 entities: <strong>RokZaPrijavuProjekta</strong> AND <strong>Predmet</strong>. </p>
  
  <p><strong>RokZaPrijavuProjekta:</strong></p>
  
  <pre><code>/**
  * @ORM\Table(name="rok_prijava_projekta")
  * @ORM\Entity(repositoryClass="JP\AdminBundle\Repository\RokZaPrijavuProjektaRepository")
  */
  class RokZaPrijavuProjekta
  {
  /**
   * @var integer $id
   *
   * @ORM\Column(name="id", type="integer")
   * @ORM\Id
   * @ORM\GeneratedValue(strategy="AUTO")
   */
  private $id;
  
  /**
   * @var integer $id_predmet
   * @ORM\ManyToOne(targetEntity="Predmet")
   * @ORM\Column(name="id_predmet", type="integer")
   */
  private $predmet;
  
  /**
   * @var date $od
   * @ORM\Column(name="od", type="date")
   */
  private $od;
  
  /**
   * @var date $do
   * @ORM\Column(name="do", type="date")
   */
  private $do;
  
  /**
   * @var string $info
   * @ORM\Column(name="info", type="string", length=120)
   */
  private $info;
  }
  </code></pre>
  
  <p><strong>Predmet entity code:</strong></p>
  
  <pre><code>/**
   * @ORM\Table(name="predmeti")
   * @ORM\Entity(repositoryClass="JP\AdminBundle\Repository\PredmetRepository")
   */
  class Predmet
  {
  /**
   * @var integer $id
   * @ORM\Column(name="id", type="integer")
   * @ORM\Id
   * @ORM\GeneratedValue(strategy="AUTO")
   */
  private $id;
  
  /**
   * @var string $sifra
   * @ORM\Column(name="sifra", type="string", length=64)
   */
  private $sifra;
  
  /**
   * @var boolean $vidljiv
   * @ORM\Column(name="vidljiv", type="boolean")
   */
  private $vidljiv;
  }
  </code></pre>
  
  <p><strong>Repository method:</strong></p>
  
  <pre><code>$q = $this-&gt;createQueryBuilder('r')
  -&gt;select('rzpp')
  -&gt;where('rzpp.predmet = :predmet')
  -&gt;from('JPAdminBundle:RokZaPrijavuProjekta', 'rzpp')
  -&gt;leftJoin("rzpp.predmet", "p")
  -&gt;setParameter('predmet', $predmet)
  -&gt;getQuery();
  </code></pre>
  
  <p>Both getters and setters for all class members are defined properly.</p>
  
  <p>Now, "RokZaPrijavuProjekta" has a foreign-key reference to "Predmet", so many of these "RokZaPrijavuProjekta" can have the same "Predmet". </p>
  
  <p>I want to create unidirectional ManyToOne relation for this purpose but keep getting exception thrown:</p>
  
  <blockquote>
    <p><em>Class JP\AdminBundle\Entity\RokZaPrijavuProjekta has no association named predmet</em> </p>
  </blockquote>
  
  <p>I went all over <a href="http://www.doctrine-project.org/docs/orm/2.0/en/reference/association-mapping.html" rel="nofollow">Doctrine documentation</a>, but found that this is the preferred way to define unidirectional many-to-one relation.</p>
  
  <p>Do you have any idea what might be a problem here?</p>
  
  <hr>
  
  <h2>UPDATE</h2>
  
  <ul>
  <li>Added Predmet entity code...</li>
  <li>Added Repository method</li>
  </ul>
  
  <hr>
  
  <p>Thanks a lot!</p>
  
  <p>Regards,
  Jovan</p>