> What about using containable to filter the results? I think containable is what is causing the problem, although I'm confused by this as I don;t have containable applied to any of my models.
In order for paginate to reorder the fetched results by a field from the Person model it needs to run a query with the model joined rather than run a query on the Referral model then run separate queries on the Person model for each fetched row (which is what it is doing using recursive=>2). What I really need to be able to do, and I have asked this in other threads when having similar issues, is force a join on a 2nd level belongsTo association, i.e. Referral belongsTo Staff (foreignKey=>Referral.staff_id) Referral belongsTo Person (foreignKey=>Staff.person_id) resulting in something like (shortened for convenience) SELECT * FROM Referral INNER JOIN Staff ON (Referral.staff_id = Staff.id) INNER JOIN Person ON (Staff.person_id = Person.id) WHERE 1 = 1 ORDER BY Person.last_name ASC However this is not possible as at the time of trying to associate/ bind the Person model to Referral it has not applied the previously defined Staff association/bind so Staff.person_id does not exist. The above SQL query is very simple and I'm concerned that Cake does not seem to allow this, or at least no-one has been able to tell me how to do this to date. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
