/**
  * 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->aUsuario !== null) {
             if ($this->aUsuario->isModified() || $this->aUsuario->isNew()) {
                 $affectedRows += $this->aUsuario->save($con);
             }
             $this->setUsuario($this->aUsuario);
         }
         if ($this->aGenero !== null) {
             if ($this->aGenero->isModified() || $this->aGenero->isNew()) {
                 $affectedRows += $this->aGenero->save($con);
             }
             $this->setGenero($this->aGenero);
         }
         if ($this->isNew() || $this->isModified()) {
             // persist changes
             if ($this->isNew()) {
                 $this->doInsert($con);
             } else {
                 $this->doUpdate($con);
             }
             $affectedRows += 1;
             $this->resetModified();
         }
         if ($this->lista_audiolibrosScheduledForDeletion !== null) {
             if (!$this->lista_audiolibrosScheduledForDeletion->isEmpty()) {
                 Lista_audiolibroQuery::create()->filterByPrimaryKeys($this->lista_audiolibrosScheduledForDeletion->getPrimaryKeys(false))->delete($con);
                 $this->lista_audiolibrosScheduledForDeletion = null;
             }
         }
         if ($this->collLista_audiolibros !== null) {
             foreach ($this->collLista_audiolibros 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 coresponding set
         // method.  This object relates to these object(s) by a
         // foreign key reference.
         if ($this->aUsuario !== null) {
             if ($this->aUsuario->isModified() || $this->aUsuario->isNew()) {
                 $affectedRows += $this->aUsuario->save($con);
             }
             $this->setUsuario($this->aUsuario);
         }
         if ($this->aGenero !== null) {
             if ($this->aGenero->isModified() || $this->aGenero->isNew()) {
                 $affectedRows += $this->aGenero->save($con);
             }
             $this->setGenero($this->aGenero);
         }
         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->aUsuarioRelatedByUsuario_ult_acc !== null) {
             if ($this->aUsuarioRelatedByUsuario_ult_acc->isModified() || $this->aUsuarioRelatedByUsuario_ult_acc->isNew()) {
                 $affectedRows += $this->aUsuarioRelatedByUsuario_ult_acc->save($con);
             }
             $this->setUsuarioRelatedByUsuario_ult_acc($this->aUsuarioRelatedByUsuario_ult_acc);
         }
         if ($this->aPrivacidad !== null) {
             if ($this->aPrivacidad->isModified() || $this->aPrivacidad->isNew()) {
                 $affectedRows += $this->aPrivacidad->save($con);
             }
             $this->setPrivacidad($this->aPrivacidad);
         }
         if ($this->aGenero !== null) {
             if ($this->aGenero->isModified() || $this->aGenero->isNew()) {
                 $affectedRows += $this->aGenero->save($con);
             }
             $this->setGenero($this->aGenero);
         }
         if ($this->aUsuarioRelatedById_usuario !== null) {
             if ($this->aUsuarioRelatedById_usuario->isModified() || $this->aUsuarioRelatedById_usuario->isNew()) {
                 $affectedRows += $this->aUsuarioRelatedById_usuario->save($con);
             }
             $this->setUsuarioRelatedById_usuario($this->aUsuarioRelatedById_usuario);
         }
         if ($this->isNew() || $this->isModified()) {
             // persist changes
             if ($this->isNew()) {
                 $this->doInsert($con);
             } else {
                 $this->doUpdate($con);
             }
             $affectedRows += 1;
             $this->resetModified();
         }
         if ($this->audiolibrosScheduledForDeletion !== null) {
             if (!$this->audiolibrosScheduledForDeletion->isEmpty()) {
                 AudiolibroQuery::create()->filterByPrimaryKeys($this->audiolibrosScheduledForDeletion->getPrimaryKeys(false))->delete($con);
                 $this->audiolibrosScheduledForDeletion = null;
             }
         }
         if ($this->collAudiolibros !== null) {
             foreach ($this->collAudiolibros as $referrerFK) {
                 if (!$referrerFK->isDeleted()) {
                     $affectedRows += $referrerFK->save($con);
                 }
             }
         }
         if ($this->calificacionsScheduledForDeletion !== null) {
             if (!$this->calificacionsScheduledForDeletion->isEmpty()) {
                 CalificacionQuery::create()->filterByPrimaryKeys($this->calificacionsScheduledForDeletion->getPrimaryKeys(false))->delete($con);
                 $this->calificacionsScheduledForDeletion = null;
             }
         }
         if ($this->collCalificacions !== null) {
             foreach ($this->collCalificacions as $referrerFK) {
                 if (!$referrerFK->isDeleted()) {
                     $affectedRows += $referrerFK->save($con);
                 }
             }
         }
         if ($this->comentariosScheduledForDeletion !== null) {
             if (!$this->comentariosScheduledForDeletion->isEmpty()) {
                 ComentarioQuery::create()->filterByPrimaryKeys($this->comentariosScheduledForDeletion->getPrimaryKeys(false))->delete($con);
                 $this->comentariosScheduledForDeletion = null;
             }
         }
         if ($this->collComentarios !== null) {
             foreach ($this->collComentarios as $referrerFK) {
                 if (!$referrerFK->isDeleted()) {
                     $affectedRows += $referrerFK->save($con);
                 }
             }
         }
         if ($this->libro_colaboradorsScheduledForDeletion !== null) {
             if (!$this->libro_colaboradorsScheduledForDeletion->isEmpty()) {
                 Libro_colaboradorQuery::create()->filterByPrimaryKeys($this->libro_colaboradorsScheduledForDeletion->getPrimaryKeys(false))->delete($con);
                 $this->libro_colaboradorsScheduledForDeletion = null;
             }
         }
         if ($this->collLibro_colaboradors !== null) {
             foreach ($this->collLibro_colaboradors as $referrerFK) {
                 if (!$referrerFK->isDeleted()) {
                     $affectedRows += $referrerFK->save($con);
                 }
             }
         }
         if ($this->libro_versionsScheduledForDeletion !== null) {
             if (!$this->libro_versionsScheduledForDeletion->isEmpty()) {
                 Libro_versionQuery::create()->filterByPrimaryKeys($this->libro_versionsScheduledForDeletion->getPrimaryKeys(false))->delete($con);
                 $this->libro_versionsScheduledForDeletion = null;
             }
         }
         if ($this->collLibro_versions !== null) {
             foreach ($this->collLibro_versions as $referrerFK) {
                 if (!$referrerFK->isDeleted()) {
                     $affectedRows += $referrerFK->save($con);
                 }
             }
         }
         if ($this->solicitudsScheduledForDeletion !== null) {
             if (!$this->solicitudsScheduledForDeletion->isEmpty()) {
                 SolicitudQuery::create()->filterByPrimaryKeys($this->solicitudsScheduledForDeletion->getPrimaryKeys(false))->delete($con);
                 $this->solicitudsScheduledForDeletion = null;
             }
         }
         if ($this->collSolicituds !== null) {
             foreach ($this->collSolicituds as $referrerFK) {
                 if (!$referrerFK->isDeleted()) {
                     $affectedRows += $referrerFK->save($con);
                 }
             }
         }
         if ($this->slider_maesScheduledForDeletion !== null) {
             if (!$this->slider_maesScheduledForDeletion->isEmpty()) {
                 Slider_maeQuery::create()->filterByPrimaryKeys($this->slider_maesScheduledForDeletion->getPrimaryKeys(false))->delete($con);
                 $this->slider_maesScheduledForDeletion = null;
             }
         }
         if ($this->collSlider_maes !== null) {
             foreach ($this->collSlider_maes as $referrerFK) {
                 if (!$referrerFK->isDeleted()) {
                     $affectedRows += $referrerFK->save($con);
                 }
             }
         }
         if ($this->postulantessScheduledForDeletion !== null) {
             if (!$this->postulantessScheduledForDeletion->isEmpty()) {
                 PostulantesQuery::create()->filterByPrimaryKeys($this->postulantessScheduledForDeletion->getPrimaryKeys(false))->delete($con);
                 $this->postulantessScheduledForDeletion = null;
             }
         }
         if ($this->collPostulantess !== null) {
             foreach ($this->collPostulantess as $referrerFK) {
                 if (!$referrerFK->isDeleted()) {
                     $affectedRows += $referrerFK->save($con);
                 }
             }
         }
         if ($this->clasificadossScheduledForDeletion !== null) {
             if (!$this->clasificadossScheduledForDeletion->isEmpty()) {
                 ClasificadosQuery::create()->filterByPrimaryKeys($this->clasificadossScheduledForDeletion->getPrimaryKeys(false))->delete($con);
                 $this->clasificadossScheduledForDeletion = null;
             }
         }
         if ($this->collClasificadoss !== null) {
             foreach ($this->collClasificadoss as $referrerFK) {
                 if (!$referrerFK->isDeleted()) {
                     $affectedRows += $referrerFK->save($con);
                 }
             }
         }
         $this->alreadyInSave = false;
     }
     return $affectedRows;
 }