E
E
Eugene2018-04-26 10:27:11
Yii
Eugene, 2018-04-26 10:27:11

How to sort by two parameters?

Made sorting so that first it shows unprocessed orders, and then processed ones

$dataProvider = new ActiveDataProvider([
            'query' => $query,
            'sort' =>
            [
                'defaultOrder' => [
                    'processed' => SORT_ASC
                ]

            ]
        ]);

But it is necessary that it additionally sorts by date. Fresh unprocessed orders first, and then older ones.
I did one parameter, but how to do it two parameters?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dmitry Kim, 2018-04-26
@evgen9586

'defaultOrder' => [
  'processed' => SORT_ASC,
  'date' => SORT_ASC,
]

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question