I do it like this : http://groups.google.com/group/cake-php/browse_thread/thread/863305f8a7267067
it works fine, even with lots of associated models. Doing `and` joins (series must have genre 'bacon' AND genre 'eggs') is more longwinded because you have to perform a separate join for each one, but it still works fine. On Apr 29, 3:53 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > Yeah, I try to use the built in functionality as much as possible as > well. I think that this particular issue is something that needs to be > added in future releases though. I've tried using the bindmodel > functions to add conditions to child models and then do a find on the > parent but this doesn't seem to work either. When you bind a model on > the fly, the binding only applies when you use that model to make the > query, not when you query it through a parent model. So yeah, this > seems like important functionality that really should be adressed. > > On Apr 29, 1:35 am, Crazy <[EMAIL PROTECTED]> wrote: > > > Thanks, I'll do a custom query then :), want to use the build in > > functionallity of cakephp as much as possible :), still pretty new at > > it. > > > On 29 apr, 00:17, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> > > wrote: > > > > I've never found a good built in solution to this. Cake does generate > > > join queries so perhaps you can look at the output of the query in the > > > debugger and create conditions that would work with it (like what you > > > are suggesting above). Otherwise, write a custom join query and use > > > $this->Model->query($sql); to execute. More often than not, this is > > > what I do for complex conditions like this. > > > > Dave > > > > On Apr 28, 3:23 pm, Crazy <[EMAIL PROTECTED]> wrote: > > > > > I am wondering if it is possible to give conditions over multiple > > > > related tables, currently I have this: > > > > > Table series: > > > > - id > > > > - name > > > > > Table genre_series: > > > > - serie_id > > > > - genre_id > > > > > Table genres: > > > > - id > > > > - name > > > > > Model is set up correctly with HABTM etc and when I do a findAll() I > > > > get the correct output. > > > > What I would like to do is something like this: > > > > > findAll("Serie.name = 'somename' AND Genre.name = 'somegenre'"); > > > > > How do I get something like this?, or do I have to use a custom SQL > > > > query? --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com 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 -~----------~----~----~----~------~----~------~--~---