title: symfony2 createQueryBuilder returns error call to member function
body: <p>I'm trying to grab a choice from another bundles entity. This always results in an error and I want to understand why:(</p>
  
  <p>I'm trying to built a form:</p>
  
  <pre><code>...
  -&gt;add('client_id', 'entity', array(
      'class'    =&gt; 'PrUserBundle:Client',
      'property' =&gt; 'name',
      'required' =&gt; true,
      'label'    =&gt; $this-&gt;get('translator')-&gt;trans('staff.location'),
  ))
  ...
  </code></pre>
  
  <p>This results in an error:</p>
  
  <pre><code>Error: Call to a member function getId() on a non-object in 
      /var/www/symfony/webprojekt/src/Pr/AdressBundle/Entity/Adress.php line 165 
  </code></pre>
  
  <p>And this is the function of line 165:</p>
  
  <pre><code>public function getClientId()
  {
      return $this-&gt;client-&gt;getId();
  }
  </code></pre>
  
  <p>What am I doing wrong? It is confusing me a bit</p>
  
  <p>EDIT: 
  I'm using a ManyToOne for the client</p>
  
  <pre><code>    /**
   * @ORM\ManyToOne(targetEntity="Pr\UserBundle\Entity\Client")
   * @ORM\JoinColumn(name="client_id", referencedColumnName="id")
   * @var Client
   */
  private $client;
  </code></pre>