Hi all,

I need some help with defining some less trivial associations.

Suppose I have the following entities:
Unit
Group
Department


A Unit can be part of multiple groups and multiple departments.
Each group belongs to one department.
If unit is part of a department, it also belongs to all the groups
belonging to that department.

So I have the following
HABTM  groups_units
HABTM departments_units
Group belongsTo department.

Now, for each unit, I can have all the groups and departments it
belongs to.

Now I need a list of ALL the groups a unit belongs to, whether it is
by the direct association to a group or by the indirect association
through a department (and therefore all the groups belonging to that
department).

I probably can have additional custom SQL to get that information (but
it will be redundant cause I already have that info in my models) or
to have a code to generate that list (where to put it?) but what would
be the best and most elegant way to have a single array of such groups
in cake?

Thanks


--~--~---------~--~----~------------~-------~--~----~
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