コード例 #1
0
ファイル: BaseSubjectAccal.php プロジェクト: taryono/school
 protected function doSave($con)
 {
     $affectedRows = 0;
     if (!$this->alreadyInSave) {
         $this->alreadyInSave = true;
         if ($this->aSubject !== null) {
             if ($this->aSubject->isModified()) {
                 $affectedRows += $this->aSubject->save($con);
             }
             $this->setSubject($this->aSubject);
         }
         if ($this->aAcademicCalendar !== null) {
             if ($this->aAcademicCalendar->isModified()) {
                 $affectedRows += $this->aAcademicCalendar->save($con);
             }
             $this->setAcademicCalendar($this->aAcademicCalendar);
         }
         if ($this->aEmployee !== null) {
             if ($this->aEmployee->isModified()) {
                 $affectedRows += $this->aEmployee->save($con);
             }
             $this->setEmployee($this->aEmployee);
         }
         if ($this->isModified()) {
             if ($this->isNew()) {
                 $pk = SubjectAccalPeer::doInsert($this, $con);
                 $affectedRows += 1;
                 $this->setId($pk);
                 $this->setNew(false);
             } else {
                 $affectedRows += SubjectAccalPeer::doUpdate($this, $con);
             }
             $this->resetModified();
         }
         if ($this->collSubjectAccalLectors !== null) {
             foreach ($this->collSubjectAccalLectors as $referrerFK) {
                 if (!$referrerFK->isDeleted()) {
                     $affectedRows += $referrerFK->save($con);
                 }
             }
         }
         if ($this->collSubjectPrereqsRelatedBySubaccalPrereq !== null) {
             foreach ($this->collSubjectPrereqsRelatedBySubaccalPrereq as $referrerFK) {
                 if (!$referrerFK->isDeleted()) {
                     $affectedRows += $referrerFK->save($con);
                 }
             }
         }
         if ($this->collSubjectPrereqsRelatedBySubaccal !== null) {
             foreach ($this->collSubjectPrereqsRelatedBySubaccal as $referrerFK) {
                 if (!$referrerFK->isDeleted()) {
                     $affectedRows += $referrerFK->save($con);
                 }
             }
         }
         if ($this->collCourseSchedules !== null) {
             foreach ($this->collCourseSchedules as $referrerFK) {
                 if (!$referrerFK->isDeleted()) {
                     $affectedRows += $referrerFK->save($con);
                 }
             }
         }
         if ($this->collVCourseSchedules !== null) {
             foreach ($this->collVCourseSchedules as $referrerFK) {
                 if (!$referrerFK->isDeleted()) {
                     $affectedRows += $referrerFK->save($con);
                 }
             }
         }
         if ($this->collVCourseSessions !== null) {
             foreach ($this->collVCourseSessions as $referrerFK) {
                 if (!$referrerFK->isDeleted()) {
                     $affectedRows += $referrerFK->save($con);
                 }
             }
         }
         if ($this->collStudentCourses !== null) {
             foreach ($this->collStudentCourses as $referrerFK) {
                 if (!$referrerFK->isDeleted()) {
                     $affectedRows += $referrerFK->save($con);
                 }
             }
         }
         if ($this->collSubjectGradings !== null) {
             foreach ($this->collSubjectGradings as $referrerFK) {
                 if (!$referrerFK->isDeleted()) {
                     $affectedRows += $referrerFK->save($con);
                 }
             }
         }
         if ($this->collVSubjectAccalLectorStudents !== null) {
             foreach ($this->collVSubjectAccalLectorStudents as $referrerFK) {
                 if (!$referrerFK->isDeleted()) {
                     $affectedRows += $referrerFK->save($con);
                 }
             }
         }
         if ($this->collVSubjectAccalLectorStudentDetails !== null) {
             foreach ($this->collVSubjectAccalLectorStudentDetails as $referrerFK) {
                 if (!$referrerFK->isDeleted()) {
                     $affectedRows += $referrerFK->save($con);
                 }
             }
         }
         $this->alreadyInSave = false;
     }
     return $affectedRows;
 }