title: Yii2-advanced : ArrayDataProvider
body: <p>I want to use <code>ArrayDataProvider</code> with the following code of siteController. I wrote the following code but it doesn't work. 
  Here is my actionIndex :</p>
  
  <pre><code>public function actionIndex()
  {
          $query = new \yii\db\Query;
          $query-&gt;select('*')-&gt;from('business_main_categories');
          $query-&gt;createCommand();
  
          $dataProviders = [];
  
          foreach ($query as $category) {
              $dataProviders[] = new ArrayDataProvider([
                  'allModels' =&gt; $category,
                  'sort' =&gt; false,
                  'pagination' =&gt; false,
              ]);
          }
  
          return $this-&gt;render('index', [
              'dataProvider' =&gt; $dataProviders,
          ]);
  }
  </code></pre>
  
  <p>And want it to iterate in gridView. So, I wrote the following code (I don't know whether it's correct or not) :</p>
  
  <p>Here is my index.php :</p>
  
  <pre><code>&lt;?php
      $dataProviders[] = 'dataProvider';
      foreach ($dataProviders as $dataProvider) {
          echo GridView::widget([
              'dataProvider' =&gt; $dataProvider,
              'summary' =&gt; '',
              'columns' =&gt; [
                  [
                          'attribute' =&gt; 'bmc_image',
                          'format' =&gt; 'html',
                          'label' =&gt; '',
                          'value' =&gt; function ($data) {
                              return Html::img($data['bmc_image'],
                                  ['width' =&gt; '210px', 'height' =&gt; '190px']);
                          },
                      ],
                  ]
         ]); 
      } 
  ?&gt;
  </code></pre>