如何将 orderBy() 与 Find() 的 where() 相加?
How to add orderBy() with where() of Find()?
如何添加带有 where 条件的 orderBy()?
$floor_data = Floors::find()->where(['building_id' => $id])->orderBy->(['floor_no' => SORT_DESC])->all();
这给我一个语法错误
syntax error, unexpected '(', expecting identifier (T_STRING) or variable (T_VARIABLE) or '{' or '$'
多余的->
导致错误:
$floor_data = Floors::find()
->where(['building_id' => $id])
// Remove ↓↓
// ->orderBy->(['floor_no' => SORT_DESC])
->orderBy(['floor_no' => SORT_DESC])
->all();
如何添加带有 where 条件的 orderBy()?
$floor_data = Floors::find()->where(['building_id' => $id])->orderBy->(['floor_no' => SORT_DESC])->all();
这给我一个语法错误
syntax error, unexpected '(', expecting identifier (T_STRING) or variable (T_VARIABLE) or '{' or '$'
多余的->
导致错误:
$floor_data = Floors::find()
->where(['building_id' => $id])
// Remove ↓↓
// ->orderBy->(['floor_no' => SORT_DESC])
->orderBy(['floor_no' => SORT_DESC])
->all();