public function createCourseSubject($course, PropelPDO $con = null)
 {
     if ($this->hasChoices()) {
         foreach ($this->getChoices() as $choice) {
             $course_subject = new CourseSubject();
             $course_subject->setCourse($course);
             $course_subject->setCareerSubjectSchoolYear($choice->getCareerSubjectSchoolYearRelatedByChoiceCareerSubjectSchoolYearId());
             $course_subject->save($con);
         }
     } else {
         $course_subject = new CourseSubject();
         $course_subject->setCourse($course);
         $course_subject->setCareerSubjectSchoolYear($this);
         $course_subject->save($con);
         if ($course->getDivision()) {
             foreach ($course->getDivision()->getDivisionStudents() as $ds) {
                 $course_subject_student = new CourseSubjectStudent();
                 $course_subject_student->setCourseSubject($course_subject);
                 $course_subject_student->setStudent($ds->getStudent());
                 $course_subject_student->save($con);
             }
         }
     }
 }
Example #2
0
 public function createFor($student, PropelPDO $con = null)
 {
     $course_student = new CourseSubjectStudent();
     $course_student->setCourseSubject($this);
     $course_student->setStudent($student);
     $course_student->save($con);
     $course_student->clearAllReferences();
     unset($course_student);
 }