Reputation: 495
How can I make a manual ordering?
My table:
table
id | name
1 | inactive
2 | active
3 | archived
And the result has to be this order: active, inactive, archived How can I make in Yii2?
Table::find()
->OrderBy(***);
Upvotes: 1
Views: 600
Reputation: 1270573
In MySQL, you would use the field()
function:
order by field(name, 'inactive', 'active', 'archived')
You can probably implement this in Yii2 using the same function.
Upvotes: 3