title: Symfony ONE-TO-ONE relation
body: <p>I am new to symfony2 and have trouble to do a left join between 2 entities. I'm getting following error message, and don't know how to solve this problem:</p>
  
  <blockquote>
    <p>[Semantical Error] line 0, col 69 near 'i': Error: Class
    Bundle\Entity\Users has no association named user_id</p>
  </blockquote>
  
  <p>Entity Users:    </p>
  
  <pre><code>class Users
  {
      /**
       * @ORM\Id
       * @ORM\Column(name="user_id", type="string", length="16")
       * @ORM\OneToOne(targetEntity="UsersInformation", mappedBy="Users")
       */
      protected $user_id;
  
      /**
       * @ORM\Column(type="string", length="255")
       */
      protected $username;
  
  
      /**
       * @ORM\Column(type="string", length="32")
       */
      protected $password;
  
      ...
  
       /**
       * Set user_id
       *
       * @param string $userId
       */
      public function setUserId($userId)
      {
          $this-&gt;user_id = $userId;
      }
  
      /**
       * Get user_id
       *
       * @return string 
       */
      public function getUserId()
      {
          return $this-&gt;user_id;
      }
  
      ...
  }
  </code></pre>
  
  <p>Entity UsersInformation:</p>
  
  <pre><code> class UsersInformation
    {
      /**
       * @ORM\Id
       * @ORM\Column(type="string", length="16")
       * @ORM\OneToOne(targetEntity="Users", inversedBy="UsersInformation")
       * @ORM\JoinColumn(name="user_id", referencedColumnName="user_id")
       */
      protected $user_id;
  
      /**
       * @ORM\Column(type="string", length="255")
       */
      public $email;
  
      /**
       * @ORM\Column(type="string", length="1")
       */
      public $gender;
  
      /**
       * @ORM\Column(type="string", length="255")
       */
      public $company;
  
      ....
    }
  </code></pre>
  
  <p>The UsersRepository looks like this:</p>
  
  <pre><code>public function getAllUsers($limit = null)
    {
          $qb = $this-&gt;createQueryBuilder('u')
                     -&gt;select('u, i')
                     -&gt;leftJoin('u.user_id', 'i');
  
  
          if (false === is_null($limit))
              $qb-&gt;setMaxResults($limit);
  
          return $qb-&gt;getQuery()
                    -&gt;getResult();
     }
  </code></pre>
  
  <p>What I'm doing wrong?</p>