I have the following situation: A project has several employees. An employee is assigned to several projects. There is no "belongsTo"-cascade because if I delete a project or
an employee, I do not want to delete the other one, of course. Two questions:
1) How do I remove the relations in the table project_employee if I delete the employee? If I use the "belongsTo"-cascade, then the table project_employee would be empty, but the project
would be deleted, too ?!
Do I have to do it manually by getting all projects of the employee,
and then remove the employee from every employee-list of each project? There should be an easier way?
2) A project has sub-projects (self referencing hasMany-relationship). The sub-project also has a M:N relation to employees. I want to realize a constraint, so that
an employee may only be within a sub-project if he is also assigned to the main project. How do I realize this constraint?