protected function doSave($con) { $affectedRows = 0; if (!$this->alreadyInSave) { $this->alreadyInSave = true; if ($this->aRegPeriod !== null) { if ($this->aRegPeriod->isModified()) { $affectedRows += $this->aRegPeriod->save($con); } $this->setRegPeriod($this->aRegPeriod); } if ($this->isModified()) { if ($this->isNew()) { $pk = RegTestPeriodPeer::doInsert($this, $con); $affectedRows += 1; $this->setId($pk); $this->setNew(false); } else { $affectedRows += RegTestPeriodPeer::doUpdate($this, $con); } $this->resetModified(); } if ($this->collTestApplicantsRelatedByRegTestPeriod1 !== null) { foreach ($this->collTestApplicantsRelatedByRegTestPeriod1 as $referrerFK) { if (!$referrerFK->isDeleted()) { $affectedRows += $referrerFK->save($con); } } } if ($this->collTestApplicantsRelatedByRegTestPeriod2 !== null) { foreach ($this->collTestApplicantsRelatedByRegTestPeriod2 as $referrerFK) { if (!$referrerFK->isDeleted()) { $affectedRows += $referrerFK->save($con); } } } if ($this->collTestSchedules !== null) { foreach ($this->collTestSchedules as $referrerFK) { if (!$referrerFK->isDeleted()) { $affectedRows += $referrerFK->save($con); } } } $this->alreadyInSave = false; } return $affectedRows; }