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

what i m doing wrong

$query = new yii\db\Query;

    $query = Positions::find()


    ->select('name')


    ->asArray()


    ->where('time between "'.start_time.'" and "'.end_time.'"')


    ->orderBy('time')


    ->all();





    $provider = new ActiveDataProvider([


'query' => $query,


'pagination' => [


    'pageSize' => 20,


],

]);

i m getting following error

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

Try this - http://www.yiiframew…taprovider.html

just remove the "->all()" will do:

$query = new yii\db\Query;

$query = Positions::find()

->select(‘name’)

->asArray()

->where(‘time between "’.start_time.’" and “’.end_time.’”’)

->orderBy(‘time’);

if i need all() then wat i need to do

1 Like