i have use mysql query:
SELECT doctor_id FROM `appointments`where doctor_id in (SELECT doctor_id FROM doctor_staffs WHERE staff_id=11)
Result:
doctor_id
2
4
5
but I need to know how to write it in CakePHP 3
i have use mysql query:
SELECT doctor_id FROM `appointments`where doctor_id in (SELECT doctor_id FROM doctor_staffs WHERE staff_id=11)
Result:
doctor_id
2
4
5
but I need to know how to write it in CakePHP 3
$this->loadModel('DoctorStaffs');
$docTorStaff=$this->DoctorStaffs->find()->select(['doctor_id'])->where(['staff_id'=>11]);
$this->loadModel('Appointments');
$appointments = $this->Appointments->find();
$appointments=$appointments->where(['Appointments.doctor_id IN'=>$docTorStaff]);