Reputation: 147
I need to pass ActiveDataProvider
object to view and I can't understand why this:
$query = Incarico::find();
$dataProvider = new ActiveDataProvider([
'query' => $query,
]);
works, while this:
$query = Incarico::find()
->joinWith('allegatos')
->all();
$dataProvider = new ActiveDataProvider([
'query' => $query,
]);
gives me the following error:
Call to a member function andFilterWhere() on array
Upvotes: 2
Views: 6236
Reputation: 33548
You should not apply all()
to $query
since ActiveDataProvider
query
property expects valid ActiveQuery
instance while you are passing results of that query.
Upvotes: 5