ttdijkstra
ttdijkstra

Reputation: 638

Results aren't ordered

The following query returns all records, but they are not in descending order. It seems the query is unaffected by the second parameter of orderBy.

\app\models\Lookup::find()->orderBy('id',SORT_DESC)->all()

Upvotes: 1

Views: 35

Answers (1)

hreitsma
hreitsma

Reputation: 121

You can either do the orderBy like a single string parameter:

\app\models\Lookup::find()->orderBy('id SORT_DESC')->all()

or as an array with key => value:

\app\models\Lookup::find()->orderBy(['id'=>SORT_DESC])->all()

Upvotes: 2

Related Questions