Hi, I cant save multiple records. I tried this test method and it still doesnt work. I get no error output and nothing is saved.
$timesheetLesson=array();
$key=0;
$timesheetLesson[$key]['tutor_id']=123;
$timesheetLesson[$key]['subject_id']=134;
$timesheetLesson[$key]['lesson_plan']='sdffdsfsdf';
$timesheetLesson[$key]['lesson_date']=date('Y-m-d');
$timesheetLesson[$key]['period_start_date']=date('Y-m-d');
$timesheetLesson[$key]['period_end_date']=date('Y-m-d');
$timesheetLesson[$key]['lesson_id']=55555;
$timesheetLesson[$key]['submit_date'] = date('Y-m-d');
$timesheetLesson[$key]['invoice']='dfgdf';
$timesheetLesson[$key]['term_id']=345;
$timesheetLesson[$key]['start_time']='10:00:00';
$timesheetLesson[$key]['end_time']='11:00:00';
$timesheetLesson[$key]['student_name']='jhkhkjhjk';
$timesheetLesson[$key]['class_year']=6;
$timesheetLesson[$key]['subjectname']='hfhfgh';
$timesheetLesson[$key]['makeup_lesson']=0;
$timesheetLesson[$key]['makeup_lesson_expired']=0;
// $timesheetLesson[$key]['makeup_expiry_date']=0;
$timesheetLesson[$key]['lesson_inactive']=0;
// $timesheetLesson[$key]['cancelled_by']=;
$timesheetLesson[$key]['schedule_rec']=0;
$timesheetLesson[$key]['forefit']=0;
// $timesheetLesson[$key]['cancelled_date']=$item['cancelled_date'];
$timesheetLesson[$key]['tutoring_type_id']=1;
$timesheetLesson[$key]['payrate']=345;
$timesheetLesson[$key]['lesson_duration']=1;
$timesheetLesson[$key]['amount']=2;
$key=1;
$timesheetLesson[$key]['tutor_id']=23;
$timesheetLesson[$key]['subject_id']=34;
$timesheetLesson[$key]['lesson_plan']='fdsfsdf';
$timesheetLesson[$key]['lesson_date']=date('Y-m-d');
$timesheetLesson[$key]['period_start_date']=date('Y-m-d');
$timesheetLesson[$key]['period_end_date']=date('Y-m-d');
$timesheetLesson[$key]['lesson_id']=9999;
$timesheetLesson[$key]['submit_date'] = date('Y-m-d');
$timesheetLesson[$key]['invoice']='dfgdf';
$timesheetLesson[$key]['term_id']=345;
$timesheetLesson[$key]['start_time']='10:00:00';
$timesheetLesson[$key]['end_time']='11:00:00';
$timesheetLesson[$key]['student_name']='jhkhkjhjk';
$timesheetLesson[$key]['class_year']=6;
$timesheetLesson[$key]['subjectname']='hfhfgh';
$timesheetLesson[$key]['makeup_lesson']=0;
$timesheetLesson[$key]['makeup_lesson_expired']=0;
// $timesheetLesson[$key]['makeup_expiry_date']=0;
$timesheetLesson[$key]['lesson_inactive']=0;
// $timesheetLesson[$key]['cancelled_by']=;
$timesheetLesson[$key]['schedule_rec']=0;
$timesheetLesson[$key]['forefit']=0;
// $timesheetLesson[$key]['cancelled_date']=$item['cancelled_date'];
$timesheetLesson[$key]['tutoring_type_id']=1;
$timesheetLesson[$key]['payrate']=345;
$timesheetLesson[$key]['lesson_duration']=1;
$timesheetLesson[$key]['amount']=2;
//debug( $this->request->data['TimesheetLesson'] );
//test
$alltimesheetLessons = $this->TimesheetLessons->newEntities( $timesheetLesson, ['validate' => false]);
// $this->TimesheetLessons->saveMany($alltimesheetLessons );
foreach ( $alltimesheetLessons as $key => $entity) {
// debug($entity->toArray());
$this->TimesheetLessons->save($entity, ['validate' => false]);
// debug( $result.' '.$key);
}//for
//test