i have to 2 database tables:
EMPLOYEES
id | name
ABSENCES
id | date | employee_id
An employee hasMany absences. This is no problem. But there are also global absences with an employee_id = 0. So this absences belongs to every employee additionaly to his own custom absences.
I tried everything but it doesn't work.
This is the created SQL of the association:
SELECT * FROM absences Absences WHERE Absences.employee_id in (1))
If I add conditions to this association (or change finder method):
SELECT * FROM absences Absences WHERE (employee_id = 0) AND Absences.employee_id in (1))
Does anybody has a solution either to change the "AND" into an "OR" or add the employee_id into the "IN" clause?
Thank you, Frank
$query->find()->where(['employee_id IN ' => [0, $employeeId]]);
http://book.cakephp.org/3.0/en/orm/query-builder.html#automatically-creating-in-clauses