Im making a website about job market, while developing I see many problems so I look back to the design to figure it out.
1- First is about something basic like employment. My scenario is this is employment management of many companies and users. User could have many skills, they can work as individual or as group. Company has many skills which are the requirements for the user. So it should be like that: companies add their skill requirements then it will list all available users or groups for each skill. Company then choose one ( hire the user or the group) then it will be put into the slot on the grid view that displays in the administrator management. There are 2 others tables WORKLOG and PAYLOG to manage the status of user and company. WORKLOG has attribute status with values: WORKING, NOT WORKING. PAYLOG has attribute status with values: PAID, NOT PAID. Therefore, when click on the slot, it must show out that which company and user on this slot, user still working or not, company pay for them or not. Other requirement is when click on any users, it must show all the slot they involving, what company they are working for, what their status of working. Same as company. Here is the list of table:
User: - id - skill_id -group_id Group: - id -skil_id Skill: - id -group_id -user_id -company_id Company: -id Worklog: -id -user_id -group_id -slot_id -status Paylog: -id -company_id -slot_id -status Slot: -id -worklog_id -paylog_id -girdview_id NOTE: there are 3 tables that not be counted in here: UserSkill, CompanySkill, UserGroup. They used to link between these table to create Many::Many relationship.
Please check if that design could work or not for this scenario. And building the relationship code for them.
Here is one of the example:( im using MANY:MANY relationship helper extenstion already)
return array( 'fk_group_user' => array(self::MANY:MANY, 'Group', UserGroup'user_id, group_id'), 'fk_skill_user' => array(self::MANY:MANY, 'Group', UserSkill'skill_id,user_id'), 'fk_worklog_user' => array(self::HAS_MANY, 'Worklog', 'user_id'), );
return array( 'fk_skill_company' => array(self::MANY:MANY, 'Skill', CompanySkill'skill_id,company_id'), 'fk_paylog_company' => array(self::HAS_MANY, 'paylog', 'company_id'), );
return array( 'fk_paylog_company' => array(self::BELONG_TO, 'Company', 'company_id'), 'fk_paylog_slot' => array(self::BELONG_TO, 'Slot', 'slot_id'), );
return array( 'fk_paylog_slot' => array(self::HAS_MANY, 'Paylog', 'slot_id'), 'fk_work_slot' => array(self::HAS_MANY, 'Worklog', 'slot_id'), );
So when I select user by id with default method from CRUD generator: $model->loadmodel(). The $model able to wrap worklog and slot but not further. So far I have:
User: $model->worklog: return array of worklog model objects $model->group:return array of group model objects $model->skill:return array of skill model objects $model->company: none-properties object $model->slot : none-properties object
It happened same as company, I could not wrap the users when perform findAll() by the relationship I created. The relationship is : user->worklog->slot<-paylog<-company. How I can know view all the companies that hire my selected user? Please help point out the mistake in my code and my design. Thanks alot