To anyone having a similar need, I managed to overcome this by copying
the paginate function to app_controller.php and adding this code right
before the $results variable is created:

                // Fix for default ordering
                if (isset($options['before_order']))
                {
                        $order = am($options['before_order'],$order);
                }

                if (isset($options['after_order']))
                {
                        $order = am($order,$options['after_order']);
                }

        if (method_exists($object, 'paginate')) {
                        $results = $object->paginate($conditions, $fields, 
$order, $limit,
$page, $recursive);
                } else {
                        $results = $object->findAll($conditions, $fields, 
$order, $limit,
$page, $recursive);
                }

Then in the controller I can specify before and after order parameters
to build custom ORDER BY statements that work with pagination:

                $this->paginate['Model'] = array(
                         'before_order' => array('no_value'=>'desc')
                         );


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to