protected function doSave($con) { $affectedRows = 0; if (!$this->alreadyInSave) { $this->alreadyInSave = true; if ($this->aOrganizationType !== null) { if ($this->aOrganizationType->isModified()) { $affectedRows += $this->aOrganizationType->save($con); } $this->setOrganizationType($this->aOrganizationType); } if ($this->isModified()) { if ($this->isNew()) { $pk = OrganizationPeer::doInsert($this, $con); $affectedRows += 1; $this->setId($pk); $this->setNew(false); } else { $affectedRows += OrganizationPeer::doUpdate($this, $con); } $this->resetModified(); } if ($this->collResearchers !== null) { foreach ($this->collResearchers as $referrerFK) { if (!$referrerFK->isDeleted()) { $affectedRows += $referrerFK->save($con); } } } if ($this->collCollaboratingOrganizations !== null) { foreach ($this->collCollaboratingOrganizations as $referrerFK) { if (!$referrerFK->isDeleted()) { $affectedRows += $referrerFK->save($con); } } } if ($this->collOrganizationResearcherKeywords !== null) { foreach ($this->collOrganizationResearcherKeywords as $referrerFK) { if (!$referrerFK->isDeleted()) { $affectedRows += $referrerFK->save($con); } } } $this->alreadyInSave = false; } return $affectedRows; }