Hmm, I posted this a few days ago but it looks like it didn't come
through.

>From what I can see you have a three way association, not three
separate two way associations.  A Module isn't associated with a Role
per se, rather it is associated with a particular User in that Role.
And ditto with the other joins.
So, I would recommend having a single join model, with hasMany /
belongsTo relationships with the three outer models.  So make a
ModuleUserRole model, using the modules_users_roles table, and your
associations will be

User hasMany ModuleUserRole
Module hasMany ModuleUserRole
Role hasMany ModuleUserRole

ModuleUserRole belongsTo Module, User, Role

You will need to manage the connections yourself - as in you will
probably want a controller action to add / edit the links.  But I
still think this is better, as in the proposal above (three HABTM) how
will you ensure that if a Module is associated with Roles 1 & 2, that
you can only select Users that are also associated with Roles 1 & 2 -
it's not going to be simple.


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" 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
-~----------~----~----~----~------~----~------~--~---

Reply via email to