Reputation: 257
i'm having trouble with order a paginate request. I'm using a MySQL View table with two fields: id, date_ordered which is the earliest of two date field in the main table. I'm using the exact same technique on an other App and all goes well. I can't figure out why the generated SQL doesn't show any ORDER BY clause.
Controller
public function admin($id=null) {
$today = date("Y-m-d");
$this->DA->recursive = 0;
$this->paginate = array(
'conditions' => array(
'DAO.date_ordered LIKE '=>"$today%",
),
'joins' => array(
array(
'table' => 'DA_ordered',
'alias' => 'DAO',
'type' => 'INNER',
'foreignKey' => false,
'conditions'=> '`DAO`.`id` = `DA`.`id`'
)
),
'order' => array('DAO.date_ordered' => 'desc'),
'limit' => 1000
);
$this->set('req', $this->paginate());
}
I have no order field in the url, and the exact same code with same structure View table goes well in an other app...
Upvotes: 2
Views: 323