Hi All,

Apologies if this has been answered multiple times before but I can't
seem to find a post which answers this question in full rather than
just a subset of it.

Problem:  An employee has zero or more managers and at the same time,
might be managing zero or more employees.

Example: CEO ---> Directors ----> Managers ---> Individual
contributors.

What is the proper way to model this?

It sounds like it is a HABTM relationship but I'm confused how to
model this for a generic case. In the example above, I was initially
thinking that I might need 3 relationship tables to model this
(CEO_Directors, Directors_Managers, etc.) each containing employee
IDs. But what if suddenly they created a position of Vice Presidents
who reports to the CEO? Or worse yet, what if their positions just
changed names?

When I hadn't even considered using CakePHP and was just thinking
about the database, I had initially planned to just add a column
"Reports To" in the employee table which would contain the employee ID
of that employee's manager. I could then recursively build out the
relationships between all employees (I think).

Any direction or help would be greatly appreciated!


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

Reply via email to