title: Yii2: Can ActiveQuery return array where the key is the first column of the SQL query?
body: <p>I often have a need for making a database query where the key of resulting array is the value of the first column specified in the SQL (instead of the key just being an auto-assigned incremental number as the array is being filled). Is that possible without having to rework the array manually afterwards?</p>
  
  <p>I know there is <code>queryAll(PDO::FETCH_KEY_PAIR)</code> but that only works for two colums (the array value is a single database column instead of a sub-array of all the remaining columns)</p>
  
  <p>So, instead of:</p>
  
  <pre><code>array (
    0 =&gt; 
      array (
        'id' =&gt; 6955,
        'firstname' =&gt; 'John',
        'lastname' =&gt; 'Doe',
        'country' =&gt; 'United States',
      ),
    1 =&gt; 
      array (
        'id' =&gt; 8588,
        'firstname' =&gt; 'Helen',
        'lastname' =&gt; 'Smith',
        'country' =&gt; 'Denmark',
      ),
  )
  </code></pre>
  
  <p>...I need:</p>
  
  <pre><code>array (
    6955 =&gt; array (
      'firstname' =&gt; 'John',
      'lastname' =&gt; 'Doe',
      'country' =&gt; 'United States',
    ),
    8588 =&gt; array (
      'firstname' =&gt; 'Helen',
      'lastname' =&gt; 'Smith',
      'country' =&gt; 'Denmark',
    ),
  )
  </code></pre>
  
  <p>It doesn't necessarily have to be arrays - it could made of objects as well. It is just the structure that is important.</p>