I would say you need a contracts_employees table that contains the contract_id and the employee_id. When the employee logs in select all contracts with his employee number and when viewing a contract select all employees with that contract number. You don't need the employer_id in it as the employees have that field.
Jeremy Burns Class Outfit http://www.classoutfit.com On 13 Apr 2013, at 10:32:45, "Advantage+" <[email protected]> wrote: > I need to properly configure this model relationship and was looking for some > insight. > > Basically : > Company hasMany Employees > Company hasMany Contracts > > I need to allow the administrator for that Company to assign a Contract to > and Employee > So Employee hasMany Contracts but the Contract <-> Company, what is the best > way to relate the Contract <-> Employee in the database with relations? > > Build a separate table employees_contracts with id, contract_id, employer_id, > employee_id? > But how to link employee to contract without having a employee_id in the > contract table? > > Ideally the Employee logs in and they see the set of Contracts assigned to > them, without having to actually have employee_id in the Contract table since > it really belongs to the Company. > > Any tips would be great. > > Thanks, > > Dave > > -- > Like Us on FaceBook https://www.facebook.com/CakePHP > Find us on Twitter http://twitter.com/CakePHP > > --- > You received this message because you are subscribed to the Google Groups > "CakePHP" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to [email protected]. > Visit this group at http://groups.google.com/group/cake-php?hl=en. > For more options, visit https://groups.google.com/groups/opt_out. > > -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups "CakePHP" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/cake-php?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
