protected function doSave($con) { $affectedRows = 0; if (!$this->alreadyInSave) { $this->alreadyInSave = true; if ($this->aChapter !== null) { if ($this->aChapter->isModified()) { $affectedRows += $this->aChapter->save($con); } $this->setChapter($this->aChapter); } if ($this->aRegion !== null) { if ($this->aRegion->isModified()) { $affectedRows += $this->aRegion->save($con); } $this->setRegion($this->aRegion); } if ($this->isModified()) { if ($this->isNew()) { $pk = ChapterregionPeer::doInsert($this, $con); $affectedRows += 1; $this->setId($pk); $this->setNew(false); } else { $affectedRows += ChapterregionPeer::doUpdate($this, $con); } $this->resetModified(); } if ($this->collUserchapterregions !== null) { foreach ($this->collUserchapterregions as $referrerFK) { if (!$referrerFK->isDeleted()) { $affectedRows += $referrerFK->save($con); } } } $this->alreadyInSave = false; } return $affectedRows; }