How to create a Yii2 Query to get an array like given below : <p>I want to get the id and name arrays as output from a query. How to do that</p>

<p>i need the output like this </p>

<pre><code>[
 ['id'=&gt;'&lt;sub-cat-id-1&gt;', 'name'=&gt;'&lt;sub-cat-name1&gt;'],
 ['id'=&gt;'&lt;sub-cat_id_2&gt;', 'name'=&gt;'&lt;sub-cat-name2&gt;']
]

</code></pre>

<p>How to get an array like above from a yii2 query</p>
