Hi,
What is the most effective way to convert cakephp2 join to cakephp3 ? I have the models setup but I dont know what the best way is even after reading
http://book.cakephp.org/3.0/en/orm/query-builder.html
$joins = array(
array('table' => 'lessons_students',
'alias' => 'LessonsStudent',
'type' => 'LEFT',
'conditions' => array(
'Lesson.id = LessonsStudent.lesson_id',
)
),
array('table' => 'students',
'alias' => 'Student',
'type' => 'LEFT',
'conditions' => array(
'LessonsStudent.student_id=Student.id',
)
),
array('table' => 'subjects',
'alias' => 'Subject',
'type' => 'LEFT',
'conditions' => array(
'Lesson.subject_id=Subject.id',
)
),
array(
'table' => 'tutors',
'alias' => 'Tutor',
'type' => 'LEFT',
'conditions' => array(
'Lesson.tutor_id = Tutor.id'
)
)
);
$fieldoptions = array( 'Lesson.lesson_date', 'Lesson.start_time', 'Lesson.end_time', 'Lesson.id','Lesson.lesson_inactive',
'Lesson.forefit','Lesson.tutor_id','Lesson.makeup_lesson_expired','Student.id',
);
// get all lessons on the day
$condionoptions = array('Lesson.lesson_inactive' => 0,'Lesson.makeup_lesson' => 0,'Lesson.forefit' => 0,
'Lesson.makeup_lesson_expired' => false, 'Lesson.lesson_date' => $lessonStartDate, 'Student.id' => $studentId,
);
$orderoptions =array('Lesson.start_time'=> 'ASC');
$lessons=$this->find('all',array(
'conditions'=> $condionoptions,
'joins'=>$joins,
'fields'=>$fieldoptions,
'recursive' =>-1,
'order'=> $orderoptions,
));