title: How to get foreign key from partial entity in Doctrine?
body: <p>I'm using Doctrine and Zend Framework 2. I don't know how to get a foreign key for the entity when I use a "<a href="http://docs.doctrine-project.org/en/latest/reference/partial-objects.html" rel="nofollow">Doctrine partials</a>". I also use a query builder and I want to return array.</p>
  
  <p>Before I used: <code>IDENTITY(e.variable)</code> , but now when I use <a href="http://docs.doctrine-project.org/en/latest/reference/partial-objects.html" rel="nofollow">partial</a> I have a code like: <code>partial e.{id, name...}</code>. And I don't know where and what should I use to get also foreign key.</p>
  
  <p>If I will use <code>e.{id, name}, IDENTITY(e.variable)</code> then I get the foreign key but it is not a part of the same array:</p>
  
  <pre><code>array (size=2)
    0 =&gt; 
      array (size=2)
        'id' =&gt; int 1
        'name' =&gt; string 'Test' (length=4)
    'countryId' =&gt; string 'en' (length=2)
  </code></pre>
  
  <p>but I'd like to get:</p>
  
  <pre><code>array (size=2)
    0 =&gt; 
      array (size=2)
        'id' =&gt; int 1
        'name' =&gt; string 'Test' (length=4)
        'countryId' =&gt; string 'en' (length=2)
  </code></pre>
  
  <p>I also know about <code>HINT_INCLUDE_META_COLUMNS</code> but this solution is for all foreign keys and then I can't decide which one I want to select or not, and I want to be more flexible.</p>