Hi everybody,

After days of trial-and-error and almost giving up, I've managed to get 
some basic and – as I believe – very common scenarios solved in CakePHP. I 
was wondering, why the documentation is not clear on these aspects, so I 
described my findings in a somewhat lengthy blog post.

You might find this helpful: 
http://www.24100.net/2012/07/cakephp-hasandbelongstomany-relationship-queries-demystified/
.

I'm addressing a couple of questions:

   - Scenario where a User and a Group model share a bidirectional 
   hasAndBelongsToMany relationship.
   - Saving a user with *multiple groups*.
   - Querying for a user *who is a member of a specific group AND at the 
   same time filtering on fields of the User model.*
   - Adding *additional groups* for an existing user *and keeping the join 
   table up-to-date.*

As I've read hundreds of questions somewhat related to this scenario on 
Stack Overflow, I assume there must be others out there, trying to wrap 
their heads around this.

I hope it helps.

Open for any conversation on Twitter, find me @ralf<http://twitter.com/ralf>
.

-- 
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
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php

Reply via email to