> True but if I have employee Bob who is a supervisor.  Bob supervises
> Tina, and Pete but Bob also has a supervisor, Sam.
>
> In this scenario wouldn't Bob have to exist in both the Employee and
> Supervisor tables?  That would be duplicate data which is bad.

Right, a supervisor may have a supervisor himself.
You can use the same model for both and put the following relationship:

        var $hasAndBelongsToMany = array(
                        'Supervisor' => array('className' => 'Employee',
                                               'joinTable' =>
'employees_supervisors',
                                               'foreignKey' => 'employee_id',
                                               'associationForeignKey'
=> 'supervisor_id',
                                               'unique' => true
                                               'conditions' =>
array('Supervisor.is_supervisor' => true), // don't know if you
declare this condition using the relationship name or the model name.
if this doesn't work, try changing Supervisor for Employee
                        )
        );


Werner Petry Moraes
http://werner.inf.br/

--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to