0

This is what I'm working with:

$this->paginate = array(
    'order' => array('Job.deadline' => 'ASC'),
    'limit' => 500
);

Not all Jobs have a deadline, and at present, with this order, the NULLS appear above those with deadlines, so in effect I have this:

NULL
NULL
NULL
28/06/2012
29/06/2012
04/07/2012

I'm desperate to get this for clarity:

28/06/2012
29/06/2012
04/07/2012
NULL
NULL
NULL

Is there a way I can achieve this through the paginate 'order' options in CakePHP. Has anyone managed this at all?

Dan Hanly
  • 7,829
  • 13
  • 73
  • 134

1 Answers1

6

Untested, but something like this should do:

'order' => array('ISNULL(Job.deadline)' => 'asc', 'Job.deadline' => 'asc')

Basically this solution in Cake syntax.

Community
  • 1
  • 1
deceze
  • 510,633
  • 85
  • 743
  • 889