Your relationship between Member and Sport are many to many, thus a hasAndBelongsToMany in CakePHP terms.
Member hasAndBelongsToMany Sport Sport hasAndBelongsToMany Member Suggest you to look into the Containable behaviour which will make your life easier. http://book.cakephp.org/view/474/Containable Enjoy, John On Oct 22, 5:58 pm, SuMiT KuMaR <[email protected]> wrote: > I have a situation when I have to filter members based on the sports > that they play. > This is a one to many relation. > > Member play many Sports > > the table structures would be conventional > > Table: members > id, name and so on... > > Table: sports > id, sport > > Table: member_sports > id, member_id, sport_id > > I need to list all the members (in Member model) and filter the > members with particular sport that they play. > > For e.g. List all members who play chess. > > When I try to add it in the condition it returns and error in WHERE > condition as the hasMany relation is computed differently and merged > the records in the final response. > > Is there a work around to filter the records based on the condition > dependent on the hasMany model. > > Thanks, > Sumit --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
