/** * Creates a new model. * If creation is successful, the browser will be redirected to the 'view' page. */ public function actionCreate() { $model = new Especialidad(); // Uncomment the following line if AJAX validation is needed // $this->performAjaxValidation($model); if (isset($_POST['Especialidad'])) { $model->attributes = $_POST['Especialidad']; if ($model->save()) { $this->redirect(array('view', 'id' => $model->especialidad_id)); } } $this->render('create', array('model' => $model)); }
/** * 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->aAgenda !== null) { if ($this->aAgenda->isModified() || $this->aAgenda->isNew()) { $affectedRows += $this->aAgenda->save($con); } $this->setAgenda($this->aAgenda); } 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(); } $this->alreadyInSave = false; } return $affectedRows; }
/** * 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; }
/** * 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 corresponding set // method. This object relates to these object(s) by a // foreign key reference. 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->admisionsScheduledForDeletion !== null) { if (!$this->admisionsScheduledForDeletion->isEmpty()) { AdmisionQuery::create()->filterByPrimaryKeys($this->admisionsScheduledForDeletion->getPrimaryKeys(false))->delete($con); $this->admisionsScheduledForDeletion = null; } } if ($this->collAdmisions !== null) { foreach ($this->collAdmisions as $referrerFK) { if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) { $affectedRows += $referrerFK->save($con); } } } if ($this->citasScheduledForDeletion !== null) { if (!$this->citasScheduledForDeletion->isEmpty()) { CitaQuery::create()->filterByPrimaryKeys($this->citasScheduledForDeletion->getPrimaryKeys(false))->delete($con); $this->citasScheduledForDeletion = null; } } if ($this->collCitas !== null) { foreach ($this->collCitas as $referrerFK) { if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) { $affectedRows += $referrerFK->save($con); } } } if ($this->consultasScheduledForDeletion !== null) { if (!$this->consultasScheduledForDeletion->isEmpty()) { ConsultaQuery::create()->filterByPrimaryKeys($this->consultasScheduledForDeletion->getPrimaryKeys(false))->delete($con); $this->consultasScheduledForDeletion = null; } } if ($this->collConsultas !== null) { foreach ($this->collConsultas as $referrerFK) { if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) { $affectedRows += $referrerFK->save($con); } } } if ($this->medicoespecialidadsScheduledForDeletion !== null) { if (!$this->medicoespecialidadsScheduledForDeletion->isEmpty()) { MedicoespecialidadQuery::create()->filterByPrimaryKeys($this->medicoespecialidadsScheduledForDeletion->getPrimaryKeys(false))->delete($con); $this->medicoespecialidadsScheduledForDeletion = null; } } if ($this->collMedicoespecialidads !== null) { foreach ($this->collMedicoespecialidads as $referrerFK) { if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) { $affectedRows += $referrerFK->save($con); } } } if ($this->medicofacturacionsScheduledForDeletion !== null) { if (!$this->medicofacturacionsScheduledForDeletion->isEmpty()) { MedicofacturacionQuery::create()->filterByPrimaryKeys($this->medicofacturacionsScheduledForDeletion->getPrimaryKeys(false))->delete($con); $this->medicofacturacionsScheduledForDeletion = null; } } if ($this->collMedicofacturacions !== null) { foreach ($this->collMedicofacturacions as $referrerFK) { if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) { $affectedRows += $referrerFK->save($con); } } } $this->alreadyInSave = false; } return $affectedRows; }