Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Multiple level ordering in Yii

This is my CActiveDataProvider

$dataProvider = new CActiveDataProvider ('MyTable', array ( 
            'pagination' => array ( 
                    'PageSize' => 4, 
                ),
            'criteria' => array ( 
                    'condition' => 'from_user_id='.$user->id,
                    'order' => 'date DESC', 
                ), 
            ));

My question is: I would like to have this CActiveDataProvider ordered first by date (as the posted code does), and in a second level, within those with the same date, order by a second criteria. Is this possible?

like image 993
Soph Avatar asked Feb 24 '23 07:02

Soph


1 Answers

Maybe I'm not understanding you correctly, but won't the following work? :

'order' => 'date DESC, name DESC',

like image 65
Eirik Hoem Avatar answered Mar 28 '23 06:03

Eirik Hoem