I have a query code in my view controller
$teacher = $this->Teachers->get($id, [
'contain' => ['Users', 'QuestionCourses' =>
function($s){
return $s->contain(['Courses', 'Questions']);
}
, 'TeacherCourses' =>
function($q){
return $q->contain(['Courses', 'Levels']);
}]
]);
$this->set('teacher', $teacher);
in this case what I want is just only count data form questions table, in table questions have a foreign key called questioncourse_id
anyone can help me to correct my code, please?
thank you
