I'm stuck on constructing a complex find statement. I have a Car model and a Cartype model that are associated via HABTM. In other words, a Jeep (Car) can be an SUV (Cartype), a Truck (Cartype), and a Convertible (Cartype).
I'm stuck on constructing the find query when searching for Cars by Cartype. If the relationship WAS Cartype HasMany Car (ie. a Car can only have one Cartype) it would be easy.... $search_criteria = array('SUV', 'Truck', 'Convertible'); $params = array( 'conditions' = array('Car.cartype_id' => $search_criteria); ) $this->Car->find('all', $params); BUT, the Car model can have many Cartypes...meaning the Car model does not have a `cartype_id` field. So how do construct a query that would mean, "give me all the Cars that are related to at least one Cartype contained in the search criteria"? Does this make sense? Thanks. --~--~---------~--~----~------------~-------~--~----~ 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 cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~----------~----~----~----~------~----~------~--~---