protected function doSave($con) { $affectedRows = 0; if (!$this->alreadyInSave) { $this->alreadyInSave = true; if ($this->aRegion !== null) { if ($this->aRegion->isModified()) { $affectedRows += $this->aRegion->save($con); } $this->setRegion($this->aRegion); } if ($this->aReligion !== null) { if ($this->aReligion->isModified()) { $affectedRows += $this->aReligion->save($con); } $this->setReligion($this->aReligion); } if ($this->aCountryRelatedByNationality !== null) { if ($this->aCountryRelatedByNationality->isModified()) { $affectedRows += $this->aCountryRelatedByNationality->save($con); } $this->setCountryRelatedByNationality($this->aCountryRelatedByNationality); } 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->aCountryRelatedByCountryId !== null) { if ($this->aCountryRelatedByCountryId->isModified()) { $affectedRows += $this->aCountryRelatedByCountryId->save($con); } $this->setCountryRelatedByCountryId($this->aCountryRelatedByCountryId); } if ($this->isModified()) { if ($this->isNew()) { $pk = StudentDetailPeer::doInsert($this, $con); $affectedRows += 1; $this->setId($pk); $this->setNew(false); } else { $affectedRows += StudentDetailPeer::doUpdate($this, $con); } $this->resetModified(); } if ($this->collStudents !== null) { foreach ($this->collStudents as $referrerFK) { if (!$referrerFK->isDeleted()) { $affectedRows += $referrerFK->save($con); } } } $this->alreadyInSave = false; } return $affectedRows; }