What might also help is a way to include recursion on only certain associations - which can be done with 'contain', but again, 'contain' is doing more db queries than it needs to.
On Nov 5, 11:38 am, Brenton B <[EMAIL PROTECTED]> wrote: > This is getting quite confusing/frustrating ... > > If I use 'contain' it's the equivalent of using 'unbind' (on the fly) > on everything not listed in 'contain' (as described in the Cookbook); > however, if I use 'contain', it seems to actually execute an extra > query to get that corresponding information, regardless of association > type. > > For example, list of members with countries (belongsTo), provinces > (belongsTo), plus a whole bunch of other stuff: webpages, interests, > etc. > > If I'm doing a listing, I just want name, country, and province, so I > can either do unbind on everything I don't need, or use 'contain' on > the things I do need .... 'contain' is the logical choice. > The resulting query does a LEFT JOIN on countries and provinces just > fine, but it ALSO does an extra query for every single country_id and > province_id to get the name. So on a big long list I'm getting quite a > few extra database hits. > > Is this supposed to do this? Because it goes against the Cookbook's > comment of "Using Containable will help you cut down on needless wear > and tear on your database". > > (This gets slightly worse once I go a level deeper.) --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
