protected function doSave($con) { $affectedRows = 0; if (!$this->alreadyInSave) { $this->alreadyInSave = true; if ($this->aSchedule !== null) { if ($this->aSchedule->isModified()) { $affectedRows += $this->aSchedule->save($con); } $this->setSchedule($this->aSchedule); } if ($this->aLocation !== null) { if ($this->aLocation->isModified()) { $affectedRows += $this->aLocation->save($con); } $this->setLocation($this->aLocation); } if ($this->aClassSession !== null) { if ($this->aClassSession->isModified()) { $affectedRows += $this->aClassSession->save($con); } $this->setClassSession($this->aClassSession); } if ($this->isModified()) { if ($this->isNew()) { $pk = ScheduleDetailPeer::doInsert($this, $con); $affectedRows += 1; $this->setId($pk); $this->setNew(false); } else { $affectedRows += ScheduleDetailPeer::doUpdate($this, $con); } $this->resetModified(); } if ($this->collStudentCourses !== null) { foreach ($this->collStudentCourses as $referrerFK) { if (!$referrerFK->isDeleted()) { $affectedRows += $referrerFK->save($con); } } } $this->alreadyInSave = false; } return $affectedRows; }