Reputation: 43
I have this query
$res = propertyDetail::find()
->joinWith('propertyImages')
->all();
$res = $res->where(['pkPropertyIDPrimary' => 1]);
I receive this error:
Call to a member function where() on array
This query contains a property Image and property detail records. Now I want to add a where clause in this dynamic.
How can I do this?
Upvotes: 0
Views: 768
Reputation: 3818
You need to do this way,
$res = propertyDetail::find()
->joinWith('propertyImages');
$res = $res->where(['pkPropertyIDPrimary' => 1])->all();
Upvotes: 1