Example #1
0
 protected function doSave($con)
 {
     $affectedRows = 0;
     if (!$this->alreadyInSave) {
         $this->alreadyInSave = true;
         if ($this->aEmployee !== null) {
             if ($this->aEmployee->isModified()) {
                 $affectedRows += $this->aEmployee->save($con);
             }
             $this->setEmployee($this->aEmployee);
         }
         if ($this->aAcademicCalendar !== null) {
             if ($this->aAcademicCalendar->isModified()) {
                 $affectedRows += $this->aAcademicCalendar->save($con);
             }
             $this->setAcademicCalendar($this->aAcademicCalendar);
         }
         if ($this->aClassGroup !== null) {
             if ($this->aClassGroup->isModified()) {
                 $affectedRows += $this->aClassGroup->save($con);
             }
             $this->setClassGroup($this->aClassGroup);
         }
         if ($this->aClassType !== null) {
             if ($this->aClassType->isModified()) {
                 $affectedRows += $this->aClassType->save($con);
             }
             $this->setClassType($this->aClassType);
         }
         if ($this->isModified()) {
             if ($this->isNew()) {
                 $pk = CounselingPeer::doInsert($this, $con);
                 $affectedRows += 1;
                 $this->setId($pk);
                 $this->setNew(false);
             } else {
                 $affectedRows += CounselingPeer::doUpdate($this, $con);
             }
             $this->resetModified();
         }
         if ($this->collTempTables !== null) {
             foreach ($this->collTempTables as $referrerFK) {
                 if (!$referrerFK->isDeleted()) {
                     $affectedRows += $referrerFK->save($con);
                 }
             }
         }
         if ($this->collCounselingTutors !== null) {
             foreach ($this->collCounselingTutors as $referrerFK) {
                 if (!$referrerFK->isDeleted()) {
                     $affectedRows += $referrerFK->save($con);
                 }
             }
         }
         if ($this->collStudentNotes !== null) {
             foreach ($this->collStudentNotes as $referrerFK) {
                 if (!$referrerFK->isDeleted()) {
                     $affectedRows += $referrerFK->save($con);
                 }
             }
         }
         $this->alreadyInSave = false;
     }
     return $affectedRows;
 }