Example #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      ConnectionInterface $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(ConnectionInterface $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->aRights !== null) {
             if ($this->aRights->isModified() || $this->aRights->isNew()) {
                 $affectedRows += $this->aRights->save($con);
             }
             $this->setRights($this->aRights);
         }
         if ($this->aBooks !== null) {
             if ($this->aBooks->isModified() || $this->aBooks->isNew()) {
                 $affectedRows += $this->aBooks->save($con);
             }
             $this->setBooks($this->aBooks);
         }
         if ($this->isNew() || $this->isModified()) {
             // persist changes
             if ($this->isNew()) {
                 $this->doInsert($con);
                 $affectedRows += 1;
             } else {
                 $affectedRows += $this->doUpdate($con);
             }
             $this->resetModified();
         }
         $this->alreadyInSave = false;
     }
     return $affectedRows;
 }
Example #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      ConnectionInterface $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(ConnectionInterface $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->auserSysRef !== null) {
             if ($this->auserSysRef->isModified() || $this->auserSysRef->isNew()) {
                 $affectedRows += $this->auserSysRef->save($con);
             }
             $this->setuserSysRef($this->auserSysRef);
         }
         if ($this->aBooks !== null) {
             if ($this->aBooks->isModified() || $this->aBooks->isNew()) {
                 $affectedRows += $this->aBooks->save($con);
             }
             $this->setBooks($this->aBooks);
         }
         if ($this->isNew() || $this->isModified()) {
             // persist changes
             if ($this->isNew()) {
                 $this->doInsert($con);
                 $affectedRows += 1;
             } else {
                 $affectedRows += $this->doUpdate($con);
             }
             $this->resetModified();
         }
         if ($this->rightssScheduledForDeletion !== null) {
             if (!$this->rightssScheduledForDeletion->isEmpty()) {
                 $pks = array();
                 foreach ($this->rightssScheduledForDeletion as $entry) {
                     $entryPk = [];
                     $entryPk[1] = $this->getId();
                     $entryPk[0] = $entry->getId();
                     $pks[] = $entryPk;
                 }
                 \RRightsForformatQuery::create()->filterByPrimaryKeys($pks)->delete($con);
                 $this->rightssScheduledForDeletion = null;
             }
         }
         if ($this->collRightss) {
             foreach ($this->collRightss as $rights) {
                 if (!$rights->isDeleted() && ($rights->isNew() || $rights->isModified())) {
                     $rights->save($con);
                 }
             }
         }
         if ($this->templatenamessScheduledForDeletion !== null) {
             if (!$this->templatenamessScheduledForDeletion->isEmpty()) {
                 $pks = array();
                 foreach ($this->templatenamessScheduledForDeletion as $entry) {
                     $entryPk = [];
                     $entryPk[1] = $this->getId();
                     $entryPk[0] = $entry->getId();
                     $pks[] = $entryPk;
                 }
                 \RTemplatenamesInchapterQuery::create()->filterByPrimaryKeys($pks)->delete($con);
                 $this->templatenamessScheduledForDeletion = null;
             }
         }
         if ($this->collTemplatenamess) {
             foreach ($this->collTemplatenamess as $templatenames) {
                 if (!$templatenames->isDeleted() && ($templatenames->isNew() || $templatenames->isModified())) {
                     $templatenames->save($con);
                 }
             }
         }
         if ($this->rRightsForformatsScheduledForDeletion !== null) {
             if (!$this->rRightsForformatsScheduledForDeletion->isEmpty()) {
                 \RRightsForformatQuery::create()->filterByPrimaryKeys($this->rRightsForformatsScheduledForDeletion->getPrimaryKeys(false))->delete($con);
                 $this->rRightsForformatsScheduledForDeletion = null;
             }
         }
         if ($this->collRRightsForformats !== null) {
             foreach ($this->collRRightsForformats as $referrerFK) {
                 if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) {
                     $affectedRows += $referrerFK->save($con);
                 }
             }
         }
         if ($this->rTemplatenamesInchaptersScheduledForDeletion !== null) {
             if (!$this->rTemplatenamesInchaptersScheduledForDeletion->isEmpty()) {
                 \RTemplatenamesInchapterQuery::create()->filterByPrimaryKeys($this->rTemplatenamesInchaptersScheduledForDeletion->getPrimaryKeys(false))->delete($con);
                 $this->rTemplatenamesInchaptersScheduledForDeletion = null;
             }
         }
         if ($this->collRTemplatenamesInchapters !== null) {
             foreach ($this->collRTemplatenamesInchapters as $referrerFK) {
                 if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) {
                     $affectedRows += $referrerFK->save($con);
                 }
             }
         }
         if ($this->contributionssScheduledForDeletion !== null) {
             if (!$this->contributionssScheduledForDeletion->isEmpty()) {
                 \ContributionsQuery::create()->filterByPrimaryKeys($this->contributionssScheduledForDeletion->getPrimaryKeys(false))->delete($con);
                 $this->contributionssScheduledForDeletion = null;
             }
         }
         if ($this->collContributionss !== null) {
             foreach ($this->collContributionss as $referrerFK) {
                 if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) {
                     $affectedRows += $referrerFK->save($con);
                 }
             }
         }
         $this->alreadyInSave = false;
     }
     return $affectedRows;
 }
Example #3
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      ConnectionInterface $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(ConnectionInterface $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->auserSysRef !== null) {
             if ($this->auserSysRef->isModified() || $this->auserSysRef->isNew()) {
                 $affectedRows += $this->auserSysRef->save($con);
             }
             $this->setuserSysRef($this->auserSysRef);
         }
         if ($this->aBooks !== null) {
             if ($this->aBooks->isModified() || $this->aBooks->isNew()) {
                 $affectedRows += $this->aBooks->save($con);
             }
             $this->setBooks($this->aBooks);
         }
         if ($this->isNew() || $this->isModified()) {
             // persist changes
             if ($this->isNew()) {
                 $this->doInsert($con);
                 $affectedRows += 1;
             } else {
                 $affectedRows += $this->doUpdate($con);
             }
             $this->resetModified();
         }
         if ($this->allPluginsScheduledForDeletion !== null) {
             if (!$this->allPluginsScheduledForDeletion->isEmpty()) {
                 $pks = array();
                 foreach ($this->allPluginsScheduledForDeletion as $entry) {
                     $entryPk = [];
                     $entryPk[0] = $this->getId();
                     $entryPk[1] = $entry->getId();
                     $pks[] = $entryPk;
                 }
                 \RIssuesAllpluginQuery::create()->filterByPrimaryKeys($pks)->delete($con);
                 $this->allPluginsScheduledForDeletion = null;
             }
         }
         if ($this->collAllPlugins) {
             foreach ($this->collAllPlugins as $allPlugin) {
                 if (!$allPlugin->isDeleted() && ($allPlugin->isNew() || $allPlugin->isModified())) {
                     $allPlugin->save($con);
                 }
             }
         }
         if ($this->narrationPluginsScheduledForDeletion !== null) {
             if (!$this->narrationPluginsScheduledForDeletion->isEmpty()) {
                 $pks = array();
                 foreach ($this->narrationPluginsScheduledForDeletion as $entry) {
                     $entryPk = [];
                     $entryPk[0] = $this->getId();
                     $entryPk[1] = $entry->getId();
                     $pks[] = $entryPk;
                 }
                 \RIssuesNarrationpluginQuery::create()->filterByPrimaryKeys($pks)->delete($con);
                 $this->narrationPluginsScheduledForDeletion = null;
             }
         }
         if ($this->collNarrationPlugins) {
             foreach ($this->collNarrationPlugins as $narrationPlugin) {
                 if (!$narrationPlugin->isDeleted() && ($narrationPlugin->isNew() || $narrationPlugin->isModified())) {
                     $narrationPlugin->save($con);
                 }
             }
         }
         if ($this->rtfPluginsScheduledForDeletion !== null) {
             if (!$this->rtfPluginsScheduledForDeletion->isEmpty()) {
                 $pks = array();
                 foreach ($this->rtfPluginsScheduledForDeletion as $entry) {
                     $entryPk = [];
                     $entryPk[0] = $this->getId();
                     $entryPk[1] = $entry->getId();
                     $pks[] = $entryPk;
                 }
                 \RIssuesRtfpluginQuery::create()->filterByPrimaryKeys($pks)->delete($con);
                 $this->rtfPluginsScheduledForDeletion = null;
             }
         }
         if ($this->collRtfPlugins) {
             foreach ($this->collRtfPlugins as $rtfPlugin) {
                 if (!$rtfPlugin->isDeleted() && ($rtfPlugin->isNew() || $rtfPlugin->isModified())) {
                     $rtfPlugin->save($con);
                 }
             }
         }
         if ($this->singlePluginsScheduledForDeletion !== null) {
             if (!$this->singlePluginsScheduledForDeletion->isEmpty()) {
                 $pks = array();
                 foreach ($this->singlePluginsScheduledForDeletion as $entry) {
                     $entryPk = [];
                     $entryPk[0] = $this->getId();
                     $entryPk[1] = $entry->getId();
                     $pks[] = $entryPk;
                 }
                 \RIssuesSinglepluginQuery::create()->filterByPrimaryKeys($pks)->delete($con);
                 $this->singlePluginsScheduledForDeletion = null;
             }
         }
         if ($this->collSinglePlugins) {
             foreach ($this->collSinglePlugins as $singlePlugin) {
                 if (!$singlePlugin->isDeleted() && ($singlePlugin->isNew() || $singlePlugin->isModified())) {
                     $singlePlugin->save($con);
                 }
             }
         }
         if ($this->xmlPluginsScheduledForDeletion !== null) {
             if (!$this->xmlPluginsScheduledForDeletion->isEmpty()) {
                 $pks = array();
                 foreach ($this->xmlPluginsScheduledForDeletion as $entry) {
                     $entryPk = [];
                     $entryPk[0] = $this->getId();
                     $entryPk[1] = $entry->getId();
                     $pks[] = $entryPk;
                 }
                 \RIssuesXmlpluginQuery::create()->filterByPrimaryKeys($pks)->delete($con);
                 $this->xmlPluginsScheduledForDeletion = null;
             }
         }
         if ($this->collXmlPlugins) {
             foreach ($this->collXmlPlugins as $xmlPlugin) {
                 if (!$xmlPlugin->isDeleted() && ($xmlPlugin->isNew() || $xmlPlugin->isModified())) {
                     $xmlPlugin->save($con);
                 }
             }
         }
         if ($this->rightssScheduledForDeletion !== null) {
             if (!$this->rightssScheduledForDeletion->isEmpty()) {
                 $pks = array();
                 foreach ($this->rightssScheduledForDeletion as $entry) {
                     $entryPk = [];
                     $entryPk[1] = $this->getId();
                     $entryPk[0] = $entry->getId();
                     $pks[] = $entryPk;
                 }
                 \RRightsForissueQuery::create()->filterByPrimaryKeys($pks)->delete($con);
                 $this->rightssScheduledForDeletion = null;
             }
         }
         if ($this->collRightss) {
             foreach ($this->collRightss as $rights) {
                 if (!$rights->isDeleted() && ($rights->isNew() || $rights->isModified())) {
                     $rights->save($con);
                 }
             }
         }
         if ($this->rIssuesAllpluginsScheduledForDeletion !== null) {
             if (!$this->rIssuesAllpluginsScheduledForDeletion->isEmpty()) {
                 \RIssuesAllpluginQuery::create()->filterByPrimaryKeys($this->rIssuesAllpluginsScheduledForDeletion->getPrimaryKeys(false))->delete($con);
                 $this->rIssuesAllpluginsScheduledForDeletion = null;
             }
         }
         if ($this->collRIssuesAllplugins !== null) {
             foreach ($this->collRIssuesAllplugins as $referrerFK) {
                 if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) {
                     $affectedRows += $referrerFK->save($con);
                 }
             }
         }
         if ($this->rIssuesNarrationpluginsScheduledForDeletion !== null) {
             if (!$this->rIssuesNarrationpluginsScheduledForDeletion->isEmpty()) {
                 \RIssuesNarrationpluginQuery::create()->filterByPrimaryKeys($this->rIssuesNarrationpluginsScheduledForDeletion->getPrimaryKeys(false))->delete($con);
                 $this->rIssuesNarrationpluginsScheduledForDeletion = null;
             }
         }
         if ($this->collRIssuesNarrationplugins !== null) {
             foreach ($this->collRIssuesNarrationplugins as $referrerFK) {
                 if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) {
                     $affectedRows += $referrerFK->save($con);
                 }
             }
         }
         if ($this->rIssuesRtfpluginsScheduledForDeletion !== null) {
             if (!$this->rIssuesRtfpluginsScheduledForDeletion->isEmpty()) {
                 \RIssuesRtfpluginQuery::create()->filterByPrimaryKeys($this->rIssuesRtfpluginsScheduledForDeletion->getPrimaryKeys(false))->delete($con);
                 $this->rIssuesRtfpluginsScheduledForDeletion = null;
             }
         }
         if ($this->collRIssuesRtfplugins !== null) {
             foreach ($this->collRIssuesRtfplugins as $referrerFK) {
                 if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) {
                     $affectedRows += $referrerFK->save($con);
                 }
             }
         }
         if ($this->rIssuesSinglepluginsScheduledForDeletion !== null) {
             if (!$this->rIssuesSinglepluginsScheduledForDeletion->isEmpty()) {
                 \RIssuesSinglepluginQuery::create()->filterByPrimaryKeys($this->rIssuesSinglepluginsScheduledForDeletion->getPrimaryKeys(false))->delete($con);
                 $this->rIssuesSinglepluginsScheduledForDeletion = null;
             }
         }
         if ($this->collRIssuesSingleplugins !== null) {
             foreach ($this->collRIssuesSingleplugins as $referrerFK) {
                 if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) {
                     $affectedRows += $referrerFK->save($con);
                 }
             }
         }
         if ($this->rIssuesXmlpluginsScheduledForDeletion !== null) {
             if (!$this->rIssuesXmlpluginsScheduledForDeletion->isEmpty()) {
                 \RIssuesXmlpluginQuery::create()->filterByPrimaryKeys($this->rIssuesXmlpluginsScheduledForDeletion->getPrimaryKeys(false))->delete($con);
                 $this->rIssuesXmlpluginsScheduledForDeletion = null;
             }
         }
         if ($this->collRIssuesXmlplugins !== null) {
             foreach ($this->collRIssuesXmlplugins as $referrerFK) {
                 if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) {
                     $affectedRows += $referrerFK->save($con);
                 }
             }
         }
         if ($this->rRightsForissuesScheduledForDeletion !== null) {
             if (!$this->rRightsForissuesScheduledForDeletion->isEmpty()) {
                 \RRightsForissueQuery::create()->filterByPrimaryKeys($this->rRightsForissuesScheduledForDeletion->getPrimaryKeys(false))->delete($con);
                 $this->rRightsForissuesScheduledForDeletion = null;
             }
         }
         if ($this->collRRightsForissues !== null) {
             foreach ($this->collRRightsForissues as $referrerFK) {
                 if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) {
                     $affectedRows += $referrerFK->save($con);
                 }
             }
         }
         if ($this->contributionssScheduledForDeletion !== null) {
             if (!$this->contributionssScheduledForDeletion->isEmpty()) {
                 \ContributionsQuery::create()->filterByPrimaryKeys($this->contributionssScheduledForDeletion->getPrimaryKeys(false))->delete($con);
                 $this->contributionssScheduledForDeletion = null;
             }
         }
         if ($this->collContributionss !== null) {
             foreach ($this->collContributionss as $referrerFK) {
                 if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) {
                     $affectedRows += $referrerFK->save($con);
                 }
             }
         }
         $this->alreadyInSave = false;
     }
     return $affectedRows;
 }