Пример #1
0
 protected function doSave($con = null)
 {
     //parent::doSave($con);
     $con = is_null($con) ? Propel::getConnection() : $con;
     $values = $this->getValues();
     try {
         $con->beginTransaction();
         if (array_key_exists('division_courses', $values)) {
             if (array_key_exists('division_title_ids', $values)) {
                 $division_title_ids = $values['division_title_ids'];
                 foreach ($division_title_ids as $division_title_id) {
                     if (DivisionPeer::checkUnique($division_title_id, $values['career_school_year_id'], $values['year'])) {
                         $division = new Division();
                         $division->setDivisionTitleId($division_title_id);
                         $division->setCareerSchoolYearId($values['career_school_year_id']);
                         $division->setShiftId($values['shift_id']);
                         $division->setYear($values['year']);
                         $this->createPreceptor($division, $con);
                         if ($this->getObject()->isNew()) {
                             foreach ($this->values['division_courses'] as $career_subject_school_year_id) {
                                 $division->createCourse($career_subject_school_year_id, $con);
                             }
                         }
                         $division->save($con);
                     }
                 }
             }
         }
         $con->commit();
     } catch (PropelException $e) {
         $con->rollback();
         throw $e;
     }
 }