Skip to content
Snippets Groups Projects
Commit 78be10c0 authored by Роман Штейнберг's avatar Роман Штейнберг
Browse files

FIX: teachers binding while sync disciplines

parent bc7fe8c8
Branches
Tags
No related merge requests found
......@@ -103,7 +103,7 @@ class Controller_Api_V0_StudyPlan extends Controller_Handler_Api
} else {
if ( !isset($discipline->teacherIDs) || (count($discipline->teacherIDs) == 0))
continue;
$lTeacherIDs = $disciplineModel->getTeachers()->as_array();
$disciplineModel = Model_Discipline::make()
->author($discipline->teacherIDs[0])
->subject($discipline->subjectID)
......@@ -111,11 +111,16 @@ class Controller_Api_V0_StudyPlan extends Controller_Handler_Api
->type($discipline->type)
->faculty($facultyID)
->create();
$lTeacher = $disciplineModel->getTeachers()->as_array();
foreach ($lTeacher as $teacher) {
$lTeacherIDs[] = $teacher['ID'];
}
}
foreach ($lTeacherIDs as $teacherID) {
$teacher = Model_Teacher::with($teacherID);
$disciplineModel->bind($teacher );
$disciplineModel->bind($teacher);
}
$res[] = (int)$disciplineModel->ID;
}
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment