/** * 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->categoriesScheduledForDeletion !== null) { if (!$this->categoriesScheduledForDeletion->isEmpty()) { $pks = array(); foreach ($this->categoriesScheduledForDeletion as $entry) { $entryPk = []; $entryPk[0] = $this->getId(); $entryPk[1] = $entry->getId(); $pks[] = $entryPk; } \ObjectCategoryQuery::create()->filterByPrimaryKeys($pks)->delete($con); $this->categoriesScheduledForDeletion = null; } } if ($this->collCategories) { foreach ($this->collCategories as $category) { if (!$category->isDeleted() && ($category->isNew() || $category->isModified())) { $category->save($con); } } } if ($this->servicessScheduledForDeletion !== null) { if (!$this->servicessScheduledForDeletion->isEmpty()) { $pks = array(); foreach ($this->servicessScheduledForDeletion as $entry) { $entryPk = []; $entryPk[0] = $this->getId(); $entryPk[1] = $entry->getId(); $pks[] = $entryPk; } \ObjectServicesQuery::create()->filterByPrimaryKeys($pks)->delete($con); $this->servicessScheduledForDeletion = null; } } if ($this->collServicess) { foreach ($this->collServicess as $services) { if (!$services->isDeleted() && ($services->isNew() || $services->isModified())) { $services->save($con); } } } if ($this->objectCategoriesScheduledForDeletion !== null) { if (!$this->objectCategoriesScheduledForDeletion->isEmpty()) { \ObjectCategoryQuery::create()->filterByPrimaryKeys($this->objectCategoriesScheduledForDeletion->getPrimaryKeys(false))->delete($con); $this->objectCategoriesScheduledForDeletion = null; } } if ($this->collObjectCategories !== null) { foreach ($this->collObjectCategories as $referrerFK) { if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) { $affectedRows += $referrerFK->save($con); } } } if ($this->objectServicessScheduledForDeletion !== null) { if (!$this->objectServicessScheduledForDeletion->isEmpty()) { \ObjectServicesQuery::create()->filterByPrimaryKeys($this->objectServicessScheduledForDeletion->getPrimaryKeys(false))->delete($con); $this->objectServicessScheduledForDeletion = null; } } if ($this->collObjectServicess !== null) { foreach ($this->collObjectServicess 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; // 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->aFileType !== null) { if ($this->aFileType->isModified() || $this->aFileType->isNew()) { $affectedRows += $this->aFileType->save($con); } $this->setFileType($this->aFileType); } if ($this->isNew() || $this->isModified()) { // persist changes if ($this->isNew()) { $this->doInsert($con); $affectedRows += 1; } else { $affectedRows += $this->doUpdate($con); } $this->resetModified(); } if ($this->categoriesScheduledForDeletion !== null) { if (!$this->categoriesScheduledForDeletion->isEmpty()) { foreach ($this->categoriesScheduledForDeletion as $category) { // need to save related object because we set the relation to null $category->save($con); } $this->categoriesScheduledForDeletion = null; } } if ($this->collCategories !== null) { foreach ($this->collCategories as $referrerFK) { if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) { $affectedRows += $referrerFK->save($con); } } } if ($this->newsScheduledForDeletion !== null) { if (!$this->newsScheduledForDeletion->isEmpty()) { foreach ($this->newsScheduledForDeletion as $news) { // need to save related object because we set the relation to null $news->save($con); } $this->newsScheduledForDeletion = null; } } if ($this->collNews !== null) { foreach ($this->collNews as $referrerFK) { if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) { $affectedRows += $referrerFK->save($con); } } } if ($this->periodicPlansScheduledForDeletion !== null) { if (!$this->periodicPlansScheduledForDeletion->isEmpty()) { foreach ($this->periodicPlansScheduledForDeletion as $periodicPlan) { // need to save related object because we set the relation to null $periodicPlan->save($con); } $this->periodicPlansScheduledForDeletion = null; } } if ($this->collPeriodicPlans !== null) { foreach ($this->collPeriodicPlans as $referrerFK) { if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) { $affectedRows += $referrerFK->save($con); } } } if ($this->productsScheduledForDeletion !== null) { if (!$this->productsScheduledForDeletion->isEmpty()) { foreach ($this->productsScheduledForDeletion as $product) { // need to save related object because we set the relation to null $product->save($con); } $this->productsScheduledForDeletion = null; } } if ($this->collProducts !== null) { foreach ($this->collProducts as $referrerFK) { if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) { $affectedRows += $referrerFK->save($con); } } } if ($this->providersScheduledForDeletion !== null) { if (!$this->providersScheduledForDeletion->isEmpty()) { foreach ($this->providersScheduledForDeletion as $provider) { // need to save related object because we set the relation to null $provider->save($con); } $this->providersScheduledForDeletion = null; } } if ($this->collProviders !== null) { foreach ($this->collProviders as $referrerFK) { if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) { $affectedRows += $referrerFK->save($con); } } } if ($this->resourceFilesScheduledForDeletion !== null) { if (!$this->resourceFilesScheduledForDeletion->isEmpty()) { \App\Propel\ResourceFileQuery::create()->filterByPrimaryKeys($this->resourceFilesScheduledForDeletion->getPrimaryKeys(false))->delete($con); $this->resourceFilesScheduledForDeletion = null; } } if ($this->collResourceFiles !== null) { foreach ($this->collResourceFiles as $referrerFK) { if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) { $affectedRows += $referrerFK->save($con); } } } if ($this->usersScheduledForDeletion !== null) { if (!$this->usersScheduledForDeletion->isEmpty()) { foreach ($this->usersScheduledForDeletion as $user) { // need to save related object because we set the relation to null $user->save($con); } $this->usersScheduledForDeletion = null; } } if ($this->collUsers !== null) { foreach ($this->collUsers 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->groupsScheduledForDeletion !== null) { if (!$this->groupsScheduledForDeletion->isEmpty()) { $pks = array(); foreach ($this->groupsScheduledForDeletion as $entry) { $entryPk = []; $entryPk[0] = $this->getId(); $entryPk[1] = $entry->getId(); $pks[] = $entryPk; } \Models\UserGroupQuery::create()->filterByPrimaryKeys($pks)->delete($con); $this->groupsScheduledForDeletion = null; } } if ($this->collGroups) { foreach ($this->collGroups as $group) { if (!$group->isDeleted() && ($group->isNew() || $group->isModified())) { $group->save($con); } } } if ($this->notesScheduledForDeletion !== null) { if (!$this->notesScheduledForDeletion->isEmpty()) { \Models\NoteQuery::create()->filterByPrimaryKeys($this->notesScheduledForDeletion->getPrimaryKeys(false))->delete($con); $this->notesScheduledForDeletion = null; } } if ($this->collNotes !== null) { foreach ($this->collNotes as $referrerFK) { if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) { $affectedRows += $referrerFK->save($con); } } } if ($this->categoriesScheduledForDeletion !== null) { if (!$this->categoriesScheduledForDeletion->isEmpty()) { \Models\CategoryQuery::create()->filterByPrimaryKeys($this->categoriesScheduledForDeletion->getPrimaryKeys(false))->delete($con); $this->categoriesScheduledForDeletion = null; } } if ($this->collCategories !== null) { foreach ($this->collCategories as $referrerFK) { if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) { $affectedRows += $referrerFK->save($con); } } } if ($this->notificationsRelatedByUserIdScheduledForDeletion !== null) { if (!$this->notificationsRelatedByUserIdScheduledForDeletion->isEmpty()) { \Models\NotificationQuery::create()->filterByPrimaryKeys($this->notificationsRelatedByUserIdScheduledForDeletion->getPrimaryKeys(false))->delete($con); $this->notificationsRelatedByUserIdScheduledForDeletion = null; } } if ($this->collNotificationsRelatedByUserId !== null) { foreach ($this->collNotificationsRelatedByUserId as $referrerFK) { if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) { $affectedRows += $referrerFK->save($con); } } } if ($this->notificationsRelatedByOriginTypeOriginIdScheduledForDeletion !== null) { if (!$this->notificationsRelatedByOriginTypeOriginIdScheduledForDeletion->isEmpty()) { foreach ($this->notificationsRelatedByOriginTypeOriginIdScheduledForDeletion as $notificationRelatedByOriginTypeOriginId) { // need to save related object because we set the relation to null $notificationRelatedByOriginTypeOriginId->save($con); } $this->notificationsRelatedByOriginTypeOriginIdScheduledForDeletion = null; } } if ($this->collNotificationsRelatedByOriginTypeOriginId !== null) { foreach ($this->collNotificationsRelatedByOriginTypeOriginId as $referrerFK) { if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) { $affectedRows += $referrerFK->save($con); } } } if ($this->commentsScheduledForDeletion !== null) { if (!$this->commentsScheduledForDeletion->isEmpty()) { \Models\CommentQuery::create()->filterByPrimaryKeys($this->commentsScheduledForDeletion->getPrimaryKeys(false))->delete($con); $this->commentsScheduledForDeletion = null; } } if ($this->collComments !== null) { foreach ($this->collComments as $referrerFK) { if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) { $affectedRows += $referrerFK->save($con); } } } if ($this->identitiesScheduledForDeletion !== null) { if (!$this->identitiesScheduledForDeletion->isEmpty()) { \Models\IdentityQuery::create()->filterByPrimaryKeys($this->identitiesScheduledForDeletion->getPrimaryKeys(false))->delete($con); $this->identitiesScheduledForDeletion = null; } } if ($this->collIdentities !== null) { foreach ($this->collIdentities as $referrerFK) { if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) { $affectedRows += $referrerFK->save($con); } } } if ($this->userGroupsScheduledForDeletion !== null) { if (!$this->userGroupsScheduledForDeletion->isEmpty()) { \Models\UserGroupQuery::create()->filterByPrimaryKeys($this->userGroupsScheduledForDeletion->getPrimaryKeys(false))->delete($con); $this->userGroupsScheduledForDeletion = null; } } if ($this->collUserGroups !== null) { foreach ($this->collUserGroups as $referrerFK) { if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) { $affectedRows += $referrerFK->save($con); } } } if ($this->sharedsScheduledForDeletion !== null) { if (!$this->sharedsScheduledForDeletion->isEmpty()) { foreach ($this->sharedsScheduledForDeletion as $shared) { // need to save related object because we set the relation to null $shared->save($con); } $this->sharedsScheduledForDeletion = null; } } if ($this->collShareds !== null) { foreach ($this->collShareds as $referrerFK) { if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) { $affectedRows += $referrerFK->save($con); } } } $this->alreadyInSave = false; } return $affectedRows; }