Custom dataprovider on Controller not working.

Hi,

I have this coded in my controller:




    public function actionIndex()

    {

    	$query = Clients::find()

		    	->where(['company_id' => '1'])

		    	->all();

    	 

    	$dataProvider = new ActiveDataProvider([

    			'query' => $query,

    			]);

    	

        return $this->render('index', [

            'dataProvider' => $dataProvider,

        ]);

    }



It does not work, error:




The "query" property must be an instance of a class that implements the QueryInterface e.g. yii\db\Query or its subclasses.



It seems to be this part:

This works:




$query = Clients::find();



This does not work:




$query = Clients::find()

  	->where(['company_id' => '1'])

  	->all();




yes, query->all returns an array (not an instance of query). Find() returns a query object.

Yes, that works perfectly, thanks.