protected function doSave($con = null)
 {
     $course = $this->getObject();
     $con = is_null($con) ? $this->getConnection() : $con;
     try {
         $con->beginTransaction();
         foreach ($course->getCoursePreceptors() as $course_preceptor) {
             $course_preceptor->delete($con);
         }
         if (isset($this->values["preceptors"])) {
             foreach ($this->values["preceptors"] as $preceptor_id) {
                 $course_preceptor = new CoursePreceptor();
                 $course_preceptor->setPreceptorId($preceptor_id);
                 $course_preceptor->setCourse($course);
                 $course_preceptor->save($con);
             }
         }
         $con->commit();
     } catch (Exception $e) {
         throw $e;
         $con->rollBack();
     }
 }
Ejemplo n.º 2
0
 public function addPreceptor($sf_user)
 {
     $course_preceptor = new CoursePreceptor();
     $course_preceptor->setCourse($this);
     $course_preceptor->setPreceptorId($sf_user->getPreceptor()->getId());
     $course_preceptor->save();
 }