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