How to add an orderBy() with a where condition?
$floor_data = Floors::find()->where(['building_id' => $id])->orderBy->(['floor_no' => SORT_DESC])->all();
This is giving me a syntax error saying
syntax error, unexpected '(', expecting identifier (T_STRING) or variable (T_VARIABLE) or '{' or '$'
The extra ->
caused the error:
$floor_data = Floors::find()
->where(['building_id' => $id])
// Remove ↓↓
// ->orderBy->(['floor_no' => SORT_DESC])
->orderBy(['floor_no' => SORT_DESC])
->all();