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