There are several options:
1) One table Employees with relationship to itself, thus able to
contain a hierarchy of employees.
2) Three tables, OrganizationUnits, Positions, Employess, with
relationships as:
- Employees --- are employed in one or more ---> Positions
- OrganizationUnits --- offers one or more ---> Positions
- Positions --- manages one or more ---> Positions

Thus:
- an employee may participate in one or more positions offered by
organization units.
- an employee may fulfill a position being managed by another
position.

Hope this helps you on the way,
   John

On Apr 8, 8:13 am, Shien <[email protected]> wrote:
> 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 [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