Пример #1
0
 /**
  * Performs the work of inserting or updating the row in the database.
  *
  * If the object is new, it inserts it; otherwise an update is performed.
  * All related objects are also updated in this method.
  *
  * @param PropelPDO $con
  * @return int             The number of rows affected by this insert/update and any referring fk objects' save() operations.
  * @throws PropelException
  * @see        save()
  */
 protected function doSave(PropelPDO $con)
 {
     $affectedRows = 0;
     // initialize var to track total num of affected rows
     if (!$this->alreadyInSave) {
         $this->alreadyInSave = true;
         // We call the save method on the following object(s) if they
         // were passed to this object by their coresponding set
         // method.  This object relates to these object(s) by a
         // foreign key reference.
         if ($this->aSalaquirurgica !== null) {
             if ($this->aSalaquirurgica->isModified() || $this->aSalaquirurgica->isNew()) {
                 $affectedRows += $this->aSalaquirurgica->save($con);
             }
             $this->setSalaquirurgica($this->aSalaquirurgica);
         }
         if ($this->aQuirofano !== null) {
             if ($this->aQuirofano->isModified() || $this->aQuirofano->isNew()) {
                 $affectedRows += $this->aQuirofano->save($con);
             }
             $this->setQuirofano($this->aQuirofano);
         }
         if ($this->aRiesgoqx !== null) {
             if ($this->aRiesgoqx->isModified() || $this->aRiesgoqx->isNew()) {
                 $affectedRows += $this->aRiesgoqx->save($con);
             }
             $this->setRiesgoqx($this->aRiesgoqx);
         }
         if ($this->aContaminacionqx !== null) {
             if ($this->aContaminacionqx->isModified() || $this->aContaminacionqx->isNew()) {
                 $affectedRows += $this->aContaminacionqx->save($con);
             }
             $this->setContaminacionqx($this->aContaminacionqx);
         }
         if ($this->aEventoqx !== null) {
             if ($this->aEventoqx->isModified() || $this->aEventoqx->isNew()) {
                 $affectedRows += $this->aEventoqx->save($con);
             }
             $this->setEventoqx($this->aEventoqx);
         }
         if ($this->aProcedimiento !== null) {
             if ($this->aProcedimiento->isModified() || $this->aProcedimiento->isNew()) {
                 $affectedRows += $this->aProcedimiento->save($con);
             }
             $this->setProcedimiento($this->aProcedimiento);
         }
         if ($this->aCausadiferido !== null) {
             if ($this->aCausadiferido->isModified() || $this->aCausadiferido->isNew()) {
                 $affectedRows += $this->aCausadiferido->save($con);
             }
             $this->setCausadiferido($this->aCausadiferido);
         }
         if ($this->aAtencion !== null) {
             if ($this->aAtencion->isModified() || $this->aAtencion->isNew()) {
                 $affectedRows += $this->aAtencion->save($con);
             }
             $this->setAtencion($this->aAtencion);
         }
         if ($this->aEspecialidad !== null) {
             if ($this->aEspecialidad->isModified() || $this->aEspecialidad->isNew()) {
                 $affectedRows += $this->aEspecialidad->save($con);
             }
             $this->setEspecialidad($this->aEspecialidad);
         }
         if ($this->isNew() || $this->isModified()) {
             // persist changes
             if ($this->isNew()) {
                 $this->doInsert($con);
             } else {
                 $this->doUpdate($con);
             }
             $affectedRows += 1;
             $this->resetModified();
         }
         if ($this->personalcirugiasScheduledForDeletion !== null) {
             if (!$this->personalcirugiasScheduledForDeletion->isEmpty()) {
                 foreach ($this->personalcirugiasScheduledForDeletion as $personalcirugia) {
                     // need to save related object because we set the relation to null
                     $personalcirugia->save($con);
                 }
                 $this->personalcirugiasScheduledForDeletion = null;
             }
         }
         if ($this->collPersonalcirugias !== null) {
             foreach ($this->collPersonalcirugias as $referrerFK) {
                 if (!$referrerFK->isDeleted()) {
                     $affectedRows += $referrerFK->save($con);
                 }
             }
         }
         if ($this->diagnosticocirugiasScheduledForDeletion !== null) {
             if (!$this->diagnosticocirugiasScheduledForDeletion->isEmpty()) {
                 foreach ($this->diagnosticocirugiasScheduledForDeletion as $diagnosticocirugia) {
                     // need to save related object because we set the relation to null
                     $diagnosticocirugia->save($con);
                 }
                 $this->diagnosticocirugiasScheduledForDeletion = null;
             }
         }
         if ($this->collDiagnosticocirugias !== null) {
             foreach ($this->collDiagnosticocirugias as $referrerFK) {
                 if (!$referrerFK->isDeleted()) {
                     $affectedRows += $referrerFK->save($con);
                 }
             }
         }
         if ($this->procedimientocirugiasScheduledForDeletion !== null) {
             if (!$this->procedimientocirugiasScheduledForDeletion->isEmpty()) {
                 foreach ($this->procedimientocirugiasScheduledForDeletion as $procedimientocirugia) {
                     // need to save related object because we set the relation to null
                     $procedimientocirugia->save($con);
                 }
                 $this->procedimientocirugiasScheduledForDeletion = null;
             }
         }
         if ($this->collProcedimientocirugias !== null) {
             foreach ($this->collProcedimientocirugias as $referrerFK) {
                 if (!$referrerFK->isDeleted()) {
                     $affectedRows += $referrerFK->save($con);
                 }
             }
         }
         if ($this->procedimientregrogramadosScheduledForDeletion !== null) {
             if (!$this->procedimientregrogramadosScheduledForDeletion->isEmpty()) {
                 foreach ($this->procedimientregrogramadosScheduledForDeletion as $procedimientregrogramado) {
                     // need to save related object because we set the relation to null
                     $procedimientregrogramado->save($con);
                 }
                 $this->procedimientregrogramadosScheduledForDeletion = null;
             }
         }
         if ($this->collProcedimientregrogramados !== null) {
             foreach ($this->collProcedimientregrogramados as $referrerFK) {
                 if (!$referrerFK->isDeleted()) {
                     $affectedRows += $referrerFK->save($con);
                 }
             }
         }
         $this->alreadyInSave = false;
     }
     return $affectedRows;
 }
Пример #2
0
 /**
  * Performs the work of inserting or updating the row in the database.
  *
  * If the object is new, it inserts it; otherwise an update is performed.
  * All related objects are also updated in this method.
  *
  * @param PropelPDO $con
  * @return int             The number of rows affected by this insert/update and any referring fk objects' save() operations.
  * @throws PropelException
  * @see        save()
  */
 protected function doSave(PropelPDO $con)
 {
     $affectedRows = 0;
     // initialize var to track total num of affected rows
     if (!$this->alreadyInSave) {
         $this->alreadyInSave = true;
         // We call the save method on the following object(s) if they
         // were passed to this object by their coresponding set
         // method.  This object relates to these object(s) by a
         // foreign key reference.
         if ($this->aQuirofano !== null) {
             if ($this->aQuirofano->isModified() || $this->aQuirofano->isNew()) {
                 $affectedRows += $this->aQuirofano->save($con);
             }
             $this->setQuirofano($this->aQuirofano);
         }
         if ($this->isNew() || $this->isModified()) {
             // persist changes
             if ($this->isNew()) {
                 $this->doInsert($con);
             } else {
                 $this->doUpdate($con);
             }
             $affectedRows += 1;
             $this->resetModified();
         }
         if ($this->agendasScheduledForDeletion !== null) {
             if (!$this->agendasScheduledForDeletion->isEmpty()) {
                 foreach ($this->agendasScheduledForDeletion as $agenda) {
                     // need to save related object because we set the relation to null
                     $agenda->save($con);
                 }
                 $this->agendasScheduledForDeletion = null;
             }
         }
         if ($this->collAgendas !== null) {
             foreach ($this->collAgendas as $referrerFK) {
                 if (!$referrerFK->isDeleted()) {
                     $affectedRows += $referrerFK->save($con);
                 }
             }
         }
         $this->alreadyInSave = false;
     }
     return $affectedRows;
 }