To lay this out real quick; I have model called "Export" which is
HABTM related with a model called "Receipt", the receipt in turn
belongs to a "User" (there's a lot of other stuff going on as well,
but these are the most important).

Now I want to fetch an Export and all it's Receipts, and I want User
info for every Receipt, so I built a query with Export (contain)
Receipt (contain) User. This returned the right data, so I was happy
for the moment.

But then I wanted to sort the Receipts on the User's last name;
however, this resulted in a query error: apparently User.fullname
wasn't in the field list. Checking out the query log I saw that indeed
instead of joins only separate queries were used to retrieve all
(directly, one on one!) related models I requested. Now apart from the
fact that this takes away my sorting options it is obviously also
undesirable for a whole lot of other reasons.

So my question: why does using containable in this fashion result in
separate queries instead of joins, and - more importantly - how do I
get it to join again?

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
[email protected] For more options, visit this group at 
http://groups.google.com/group/cake-php

Reply via email to