0

I'm paginating some results within my cakephp 2.x install. They work fine with the following code:

$this->Paginator->settings = array(
        'conditions' => array('not' => array('Listing.status_code' => '1')),
        'limit' => 20,
        );

But when I order the results:

$this->Paginator->settings = array(
        'conditions' => array('not' => array('Listing.status_code' => '1')),
        'limit' => 20,
        'order' => array('Listing.created' => 'desc'),
        );

These two values: Listing.image, Listing.images_dir become empty in the array?!

The only difference between image and images_dir and the other values in the table could be to do with the Upload plugin used to save the values in the Model, but I don't see why this would cause a problem when retrieving the values. Removing Upload from $actsAs does not resolve the problem.

Any ideas where I should look to resolve this?

4
  • 1
    Try changing order to a string instead of an array: 'Listing.created desc'
    – Dave
    Nov 17, 2013 at 2:18
  • @dave thanks, but nope, turning to a string has no affect on order.
    – squeaker
    Nov 17, 2013 at 5:15
  • Would help greatly if you showed both the before and after queries it generates.
    – Dave
    Nov 17, 2013 at 5:42
  • 1
    try to on debug mode and share queries with and without ordering Nov 17, 2013 at 10:04

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.