Building a filer

I am converting some finds from cakephp2 to cakephp3.
I am building a search filter and seem to have created it. Is this how it is done or is there a more efficient way? It returns all the rows required.

$query3 = $this->Lessons->find()
->contain([‘Tutors’,‘Subjects’, ‘TutoringTypes’,‘Terms’,‘Students’])
->select([‘lessons.id’,‘lessons.lesson_date’,‘tutors.id’,‘tutors.first_name’,
‘tutors.last_name’,‘lessons.tutoring_type_id’,
subjects.id’,‘subjects.name’,‘terms.id’,‘terms.title’])

           ->where(['Lessons.lesson_date >' => $a3,'Lessons.lesson_date <' => $a4,
              'tutors.first_name like' => '%'.$a5.'%','tutors.last_name like' => '%'.$a6.'%',
                   'subjects.name like' => '%'.$a7.'%',
             'OR' => [['lessons.tutoring_type_id' => 2], ['lessons.tutoring_type_id' => 1]]
               ]);
       
        $query3->matching('Students', function ($q) use ($a8) {
              
             return $q
                ->select(['students.id','students.first_name','students.last_name']) 
              ->where(['Students.first_name like' =>'%'.$a8.'%']);
            });