protected function doSave($con) { $affectedRows = 0; if (!$this->alreadyInSave) { $this->alreadyInSave = true; if ($this->aCatSubjectRelatedByParent !== null) { if ($this->aCatSubjectRelatedByParent->isModified()) { $affectedRows += $this->aCatSubjectRelatedByParent->save($con); } $this->setCatSubjectRelatedByParent($this->aCatSubjectRelatedByParent); } if ($this->isModified()) { if ($this->isNew()) { $pk = CatSubjectPeer::doInsert($this, $con); $affectedRows += 1; $this->setId($pk); $this->setNew(false); } else { $affectedRows += CatSubjectPeer::doUpdate($this, $con); } $this->resetModified(); } if ($this->collCatSubjectsRelatedByParent !== null) { foreach ($this->collCatSubjectsRelatedByParent as $referrerFK) { if (!$referrerFK->isDeleted()) { $affectedRows += $referrerFK->save($con); } } } if ($this->collCatalogs !== null) { foreach ($this->collCatalogs as $referrerFK) { if (!$referrerFK->isDeleted()) { $affectedRows += $referrerFK->save($con); } } } $this->alreadyInSave = false; } return $affectedRows; }