title: How to define multiple many-to-one relations between two Doctrine tables?
body: <p>I've got a problem with doctrine with Symfony when I try to define to relations Many-to-one between the table Challenge and User getting the next error.</p>
  
  <p>Error when I try to define:</p>
  
  <p><img src="https://i.stack.imgur.com/CIFlP.png" alt="enter image description here"></p>
  
  <p>The table User has the attribute: id, challengesMaked, challengesReceived and the table Challenge has these atributes: id, idUser1, idUser2 where idUser1 I want to relation with id from User and idUser2 I want to relation with id from User too. The relation between User and Challenge are One to Many (One user can challenge to another user) and between Challenge to User are Many to One (One challenge is received only by a User)</p>
  
  <p>So, how can I define this attributes in my entity to fix my bug. Right now, in my User Entity I have defined these attributes like ...</p>
  
  <pre><code>    /**
   * @var Challenge ArrayCollection
   * @ORM\OneToMany(targetEntity="\MQL\PlayerBundle\Entity\Challenge", mappedBy="idUser1", cascade={"persist"})
   */
  protected $challengesMaked;
  
  /**
   * @var Challenge ArrayCollection
   * @ORM\OneToMany(targetEntity="\MQL\PlayerBundle\Entity\Challenge", mappedBy="idUser2", cascade={"persist"})
   */    
  protected $challengesReceived;
  </code></pre>
  
  <p>And in the Challenge Entity I have defined ...</p>
  
  <pre><code>    /**
   * @var User ArrayCollection
   * @ORM\ManyToOne(targetEntity="\FOS\UserBundle\Entity\User", inversedBy="challengesMaked")
   **/    
  protected $idUser1;                 //Challenger
  
  /**
   * @var User ArrayCollection
   * @ORM\ManyToOne(targetEntity="\FOS\UserBundle\Entity\User", inversedBy="challengesReceived")
   **/    
  protected $idUser2;     //Challenged
  </code></pre>
  
  <p>What am I doing wrong? </p>