Hi all,

I am not finding a solution for the following issue:

I have a perfectly working pagination query for model X that returns
data from:

* model X itself

* model Y, through a LEFT join to a DB table added with

    $this->paginate['joins'][] = array(
        'type' => 'LEFT',
        'table' => 'ys',
        'alias' => 'Y' ...

* Z, through a LEFT join to a custom SELECT added with

    $this->paginate['joins'][] = array(
        'type' => 'LEFT',
        'table' => '(SELECT ... FROM ... WHERE ...)',
        'alias' => 'Z' ...

The problem is that, while I can sort for pagination both X and Y data
with $paginator->sort, the same thing is not working with Z.

While
$paginator->sort('weight', 'Y.banana_weight')
nicely produces
...ORDER BY `Y`.`banana_weight`...
at the end of the SQL query,

something like
$paginator->sort('name', 'Z.apple_name')
is failing to produce the corresponding
...ORDER BY `Z`.`apple_name`...
at the end of the SQL query, nothing is there (so the view is shown
but not ordered).
But both `Y`.`banana_weight` and `Z`.`apple_name` are existing fields
in the query results and in the array returned by Cake.

What I can certainly see is that Z is not a defined model, but still I
would have expected this to work. Any idea or workaround?

Thank you in advance,

Mario

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" 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