protected function doSave($con) { $affectedRows = 0; if (!$this->alreadyInSave) { $this->alreadyInSave = true; if ($this->aColLocationRelatedByParent !== null) { if ($this->aColLocationRelatedByParent->isModified()) { $affectedRows += $this->aColLocationRelatedByParent->save($con); } $this->setColLocationRelatedByParent($this->aColLocationRelatedByParent); } if ($this->aDepartment !== null) { if ($this->aDepartment->isModified()) { $affectedRows += $this->aDepartment->save($con); } $this->setDepartment($this->aDepartment); } if ($this->isModified()) { if ($this->isNew()) { $pk = ColLocationPeer::doInsert($this, $con); $affectedRows += 1; $this->setId($pk); $this->setNew(false); } else { $affectedRows += ColLocationPeer::doUpdate($this, $con); } $this->resetModified(); } if ($this->collColLocationsRelatedByParent !== null) { foreach ($this->collColLocationsRelatedByParent as $referrerFK) { if (!$referrerFK->isDeleted()) { $affectedRows += $referrerFK->save($con); } } } $this->alreadyInSave = false; } return $affectedRows; }