2016-03-07 38 views
0

條款我有這個疑問其中警予

$res = propertyDetail::find() 
    ->joinWith('propertyImages') 
    ->all(); 

$res = $res->where(['pkPropertyIDPrimary' => 1]); 

動態查詢我收到此錯誤:

Call to a member function where() on array

此查詢包含一個屬性圖片和財產明細記錄。現在我想在這個動態中添加一個where子句。

我該怎麼做?

回答

1

你需要做的這種方式,

$res = propertyDetail::find() 
     ->joinWith('propertyImages'); 

$res = $res->where(['pkPropertyIDPrimary' => 1])->all(); 
+0

由於ANS先生 –