title: zend framework - can result array from sql query contain database names?
body: <p>If we run a query such as the following:</p>
  
  <pre><code>SELECT `user`.`user_id`
       , `user`.`username`
       , `profile`.`user_id`
       , `profile`.`name`
       , `profile`.`location`
    FROM `user`
    JOIN `profile`
   USING (`user_id`)
   WHERE `user`.`user_id` = 1;
  </code></pre>
  
  <p>then we get the result set:</p>
  
  <pre><code>object(ArrayObject)
      private 'storage' =&gt; 
          array
             'user_id' =&gt; string '1'
             'username' =&gt; string 'ExampleUsername'
             'name' =&gt; string 'Example name'
             'location' =&gt; string 'Example location'
  </code></pre>
  
  <p>Notice that <code>user_id</code> field is only returned once, even though it exists twice in the SQL query.</p>
  
  <p>Is there a way to return table names as part of the result set? For example, the following result set would be desired:</p>
  
  <pre><code>object(ArrayObject)
      private 'storage' =&gt; 
          array
             'user' =&gt; array
                 'user_id' =&gt; string '1'
                 'username' =&gt; string 'ExampleUsername'
             'profile' =&gt; array
                 'user_id' =&gt; string '1'
                 'name' =&gt; string 'Example name'
                 'location' =&gt; string 'Example location'
  </code></pre>
  
  <p>I have seen this done in other frameworks (Laravel, CodeIgniter) but am not seeing the option for Zend Framework version 2 or 3.</p>
  
  <p>This is just an example SQL query. We are running much more complex queries in our project where a returned associative array with table names as keys would be ideal.</p>