/** * 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->isNew() || $this->isModified()) { // persist changes if ($this->isNew()) { $this->doInsert($con); $affectedRows += 1; } else { $affectedRows += $this->doUpdate($con); } $this->resetModified(); } if ($this->batchesScheduledForDeletion !== null) { if (!$this->batchesScheduledForDeletion->isEmpty()) { $pks = array(); foreach ($this->batchesScheduledForDeletion as $entry) { $entryPk = []; $entryPk[1] = $this->getId(); $entryPk[0] = $entry->getId(); $pks[] = $entryPk; } \RBatchForbookQuery::create()->filterByPrimaryKeys($pks)->delete($con); $this->batchesScheduledForDeletion = null; } } if ($this->collBatches) { foreach ($this->collBatches as $batch) { if (!$batch->isDeleted() && ($batch->isNew() || $batch->isModified())) { $batch->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; } \RRightsForbookQuery::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; } \RTemplatenamesForbookQuery::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->rBatchForbooksScheduledForDeletion !== null) { if (!$this->rBatchForbooksScheduledForDeletion->isEmpty()) { \RBatchForbookQuery::create()->filterByPrimaryKeys($this->rBatchForbooksScheduledForDeletion->getPrimaryKeys(false))->delete($con); $this->rBatchForbooksScheduledForDeletion = null; } } if ($this->collRBatchForbooks !== null) { foreach ($this->collRBatchForbooks as $referrerFK) { if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) { $affectedRows += $referrerFK->save($con); } } } if ($this->rRightsForbooksScheduledForDeletion !== null) { if (!$this->rRightsForbooksScheduledForDeletion->isEmpty()) { \RRightsForbookQuery::create()->filterByPrimaryKeys($this->rRightsForbooksScheduledForDeletion->getPrimaryKeys(false))->delete($con); $this->rRightsForbooksScheduledForDeletion = null; } } if ($this->collRRightsForbooks !== null) { foreach ($this->collRRightsForbooks as $referrerFK) { if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) { $affectedRows += $referrerFK->save($con); } } } if ($this->rTemplatenamesForbooksScheduledForDeletion !== null) { if (!$this->rTemplatenamesForbooksScheduledForDeletion->isEmpty()) { \RTemplatenamesForbookQuery::create()->filterByPrimaryKeys($this->rTemplatenamesForbooksScheduledForDeletion->getPrimaryKeys(false))->delete($con); $this->rTemplatenamesForbooksScheduledForDeletion = null; } } if ($this->collRTemplatenamesForbooks !== null) { foreach ($this->collRTemplatenamesForbooks as $referrerFK) { if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) { $affectedRows += $referrerFK->save($con); } } } if ($this->formatssScheduledForDeletion !== null) { if (!$this->formatssScheduledForDeletion->isEmpty()) { \FormatsQuery::create()->filterByPrimaryKeys($this->formatssScheduledForDeletion->getPrimaryKeys(false))->delete($con); $this->formatssScheduledForDeletion = null; } } if ($this->collFormatss !== null) { foreach ($this->collFormatss as $referrerFK) { if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) { $affectedRows += $referrerFK->save($con); } } } if ($this->issuessScheduledForDeletion !== null) { if (!$this->issuessScheduledForDeletion->isEmpty()) { \IssuesQuery::create()->filterByPrimaryKeys($this->issuessScheduledForDeletion->getPrimaryKeys(false))->delete($con); $this->issuessScheduledForDeletion = null; } } if ($this->collIssuess !== null) { foreach ($this->collIssuess as $referrerFK) { if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) { $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 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; 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; } \RRightsFortemplateQuery::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->bookssScheduledForDeletion !== null) { if (!$this->bookssScheduledForDeletion->isEmpty()) { $pks = array(); foreach ($this->bookssScheduledForDeletion as $entry) { $entryPk = []; $entryPk[0] = $this->getId(); $entryPk[1] = $entry->getId(); $pks[] = $entryPk; } \RTemplatenamesForbookQuery::create()->filterByPrimaryKeys($pks)->delete($con); $this->bookssScheduledForDeletion = null; } } if ($this->collBookss) { foreach ($this->collBookss as $books) { if (!$books->isDeleted() && ($books->isNew() || $books->isModified())) { $books->save($con); } } } if ($this->formatssScheduledForDeletion !== null) { if (!$this->formatssScheduledForDeletion->isEmpty()) { $pks = array(); foreach ($this->formatssScheduledForDeletion as $entry) { $entryPk = []; $entryPk[0] = $this->getId(); $entryPk[1] = $entry->getId(); $pks[] = $entryPk; } \RTemplatenamesInchapterQuery::create()->filterByPrimaryKeys($pks)->delete($con); $this->formatssScheduledForDeletion = null; } } if ($this->collFormatss) { foreach ($this->collFormatss as $formats) { if (!$formats->isDeleted() && ($formats->isNew() || $formats->isModified())) { $formats->save($con); } } } if ($this->rRightsFortemplatesScheduledForDeletion !== null) { if (!$this->rRightsFortemplatesScheduledForDeletion->isEmpty()) { \RRightsFortemplateQuery::create()->filterByPrimaryKeys($this->rRightsFortemplatesScheduledForDeletion->getPrimaryKeys(false))->delete($con); $this->rRightsFortemplatesScheduledForDeletion = null; } } if ($this->collRRightsFortemplates !== null) { foreach ($this->collRRightsFortemplates as $referrerFK) { if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) { $affectedRows += $referrerFK->save($con); } } } if ($this->rTemplatenamesForbooksScheduledForDeletion !== null) { if (!$this->rTemplatenamesForbooksScheduledForDeletion->isEmpty()) { \RTemplatenamesForbookQuery::create()->filterByPrimaryKeys($this->rTemplatenamesForbooksScheduledForDeletion->getPrimaryKeys(false))->delete($con); $this->rTemplatenamesForbooksScheduledForDeletion = null; } } if ($this->collRTemplatenamesForbooks !== null) { foreach ($this->collRTemplatenamesForbooks 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); } } } if ($this->templatessScheduledForDeletion !== null) { if (!$this->templatessScheduledForDeletion->isEmpty()) { \TemplatesQuery::create()->filterByPrimaryKeys($this->templatessScheduledForDeletion->getPrimaryKeys(false))->delete($con); $this->templatessScheduledForDeletion = null; } } if ($this->collTemplatess !== null) { foreach ($this->collTemplatess as $referrerFK) { if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) { $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 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; 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; } \RRightsForuserQuery::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->rRightsForusersScheduledForDeletion !== null) { if (!$this->rRightsForusersScheduledForDeletion->isEmpty()) { \RRightsForuserQuery::create()->filterByPrimaryKeys($this->rRightsForusersScheduledForDeletion->getPrimaryKeys(false))->delete($con); $this->rRightsForusersScheduledForDeletion = null; } } if ($this->collRRightsForusers !== null) { foreach ($this->collRRightsForusers as $referrerFK) { if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) { $affectedRows += $referrerFK->save($con); } } } if ($this->bookssScheduledForDeletion !== null) { if (!$this->bookssScheduledForDeletion->isEmpty()) { foreach ($this->bookssScheduledForDeletion as $books) { // need to save related object because we set the relation to null $books->save($con); } $this->bookssScheduledForDeletion = null; } } if ($this->collBookss !== null) { foreach ($this->collBookss as $referrerFK) { if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) { $affectedRows += $referrerFK->save($con); } } } if ($this->contributionssScheduledForDeletion !== null) { if (!$this->contributionssScheduledForDeletion->isEmpty()) { foreach ($this->contributionssScheduledForDeletion as $contributions) { // need to save related object because we set the relation to null $contributions->save($con); } $this->contributionssScheduledForDeletion = null; } } if ($this->collContributionss !== null) { foreach ($this->collContributionss as $referrerFK) { if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) { $affectedRows += $referrerFK->save($con); } } } if ($this->datasScheduledForDeletion !== null) { if (!$this->datasScheduledForDeletion->isEmpty()) { foreach ($this->datasScheduledForDeletion as $data) { // need to save related object because we set the relation to null $data->save($con); } $this->datasScheduledForDeletion = null; } } if ($this->collDatas !== null) { foreach ($this->collDatas as $referrerFK) { if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) { $affectedRows += $referrerFK->save($con); } } } if ($this->formatssScheduledForDeletion !== null) { if (!$this->formatssScheduledForDeletion->isEmpty()) { foreach ($this->formatssScheduledForDeletion as $formats) { // need to save related object because we set the relation to null $formats->save($con); } $this->formatssScheduledForDeletion = null; } } if ($this->collFormatss !== null) { foreach ($this->collFormatss as $referrerFK) { if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) { $affectedRows += $referrerFK->save($con); } } } if ($this->issuessScheduledForDeletion !== null) { if (!$this->issuessScheduledForDeletion->isEmpty()) { foreach ($this->issuessScheduledForDeletion as $issues) { // need to save related object because we set the relation to null $issues->save($con); } $this->issuessScheduledForDeletion = null; } } if ($this->collIssuess !== null) { foreach ($this->collIssuess as $referrerFK) { if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) { $affectedRows += $referrerFK->save($con); } } } $this->alreadyInSave = false; } return $affectedRows; }