on several places in same controller i have code like:
$publications = $this->paginate('Publication', $conditions);
...where $conditions is array of conditions, which fields to select and how (using LIKE in mysql).
every one of them have different "Order by" statement.
how can i achieve that, and define different "order by" part of sql?
UPDATE (2011-03-11): this is part how i defined pagination:
$this->paginate = array(
'limit' => 1,
'fields' => array('`Publication`.*, PublicationNumeration.*, Collection.*, Publisher.*, Publication.title as PublicationTitle'),
'joins' => array( array('table' => 'publication_numerations', 'alias' => 'PublicationNumeration', 'type' => 'LEFT', 'conditions' => array( 'Publication.id = PublicationNumeration.publication_id' ) ) )
, 'order' => array('PublicationTitle desc')
);
$publications = $this->paginate('Publication', $conditions);
$this->set(compact('publications', 'urlArgs'));
part with 'limit' works, but 'order' does not works, and does not show in debug mode at all.
$conditions
array. – deceze