Example #1
0
 protected function doSave($con)
 {
     $affectedRows = 0;
     if (!$this->alreadyInSave) {
         $this->alreadyInSave = true;
         if ($this->aCourseSchedule !== null) {
             if ($this->aCourseSchedule->isModified()) {
                 $affectedRows += $this->aCourseSchedule->save($con);
             }
             $this->setCourseSchedule($this->aCourseSchedule);
         }
         if ($this->aClassSession !== null) {
             if ($this->aClassSession->isModified()) {
                 $affectedRows += $this->aClassSession->save($con);
             }
             $this->setClassSession($this->aClassSession);
         }
         if ($this->aSubjectGrading !== null) {
             if ($this->aSubjectGrading->isModified()) {
                 $affectedRows += $this->aSubjectGrading->save($con);
             }
             $this->setSubjectGrading($this->aSubjectGrading);
         }
         if ($this->aStudent !== null) {
             if ($this->aStudent->isModified()) {
                 $affectedRows += $this->aStudent->save($con);
             }
             $this->setStudent($this->aStudent);
         }
         if ($this->aStudentAbsence !== null) {
             if ($this->aStudentAbsence->isModified()) {
                 $affectedRows += $this->aStudentAbsence->save($con);
             }
             $this->setStudentAbsence($this->aStudentAbsence);
         }
         if ($this->aClassGroup !== null) {
             if ($this->aClassGroup->isModified()) {
                 $affectedRows += $this->aClassGroup->save($con);
             }
             $this->setClassGroup($this->aClassGroup);
         }
         if ($this->aSchedule !== null) {
             if ($this->aSchedule->isModified()) {
                 $affectedRows += $this->aSchedule->save($con);
             }
             $this->setSchedule($this->aSchedule);
         }
         if ($this->aEmployee !== null) {
             if ($this->aEmployee->isModified()) {
                 $affectedRows += $this->aEmployee->save($con);
             }
             $this->setEmployee($this->aEmployee);
         }
         if ($this->isModified()) {
             if ($this->isNew()) {
                 $pk = ClassAgendaPeer::doInsert($this, $con);
                 $affectedRows += 1;
                 $this->setId($pk);
                 $this->setNew(false);
             } else {
                 $affectedRows += ClassAgendaPeer::doUpdate($this, $con);
             }
             $this->resetModified();
         }
         if ($this->collClassAgendaFiles !== null) {
             foreach ($this->collClassAgendaFiles as $referrerFK) {
                 if (!$referrerFK->isDeleted()) {
                     $affectedRows += $referrerFK->save($con);
                 }
             }
         }
         if ($this->collClassAbsences !== null) {
             foreach ($this->collClassAbsences as $referrerFK) {
                 if (!$referrerFK->isDeleted()) {
                     $affectedRows += $referrerFK->save($con);
                 }
             }
         }
         $this->alreadyInSave = false;
     }
     return $affectedRows;
 }