Esempio n. 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->aOwner !== null) {
             if ($this->aOwner->isModified() || $this->aOwner->isNew()) {
                 $affectedRows += $this->aOwner->save($con);
             }
             $this->setOwner($this->aOwner);
         }
         if ($this->isNew() || $this->isModified()) {
             // persist changes
             if ($this->isNew()) {
                 $this->doInsert($con);
                 $affectedRows += 1;
             } else {
                 $affectedRows += $this->doUpdate($con);
             }
             $this->resetModified();
         }
         if ($this->usersScheduledForDeletion !== null) {
             if (!$this->usersScheduledForDeletion->isEmpty()) {
                 $pks = array();
                 foreach ($this->usersScheduledForDeletion as $entry) {
                     $entryPk = [];
                     $entryPk[1] = $this->getId();
                     $entryPk[0] = $entry->getId();
                     $pks[] = $entryPk;
                 }
                 \Models\UserGroupQuery::create()->filterByPrimaryKeys($pks)->delete($con);
                 $this->usersScheduledForDeletion = null;
             }
         }
         if ($this->collUsers) {
             foreach ($this->collUsers as $user) {
                 if (!$user->isDeleted() && ($user->isNew() || $user->isModified())) {
                     $user->save($con);
                 }
             }
         }
         if ($this->packPermissionsScheduledForDeletion !== null) {
             if (!$this->packPermissionsScheduledForDeletion->isEmpty()) {
                 \Models\PackPermissionQuery::create()->filterByPrimaryKeys($this->packPermissionsScheduledForDeletion->getPrimaryKeys(false))->delete($con);
                 $this->packPermissionsScheduledForDeletion = null;
             }
         }
         if ($this->collPackPermissions !== null) {
             foreach ($this->collPackPermissions 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);
                 }
             }
         }
         $this->alreadyInSave = false;
     }
     return $affectedRows;
 }
Esempio n. 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->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;
 }
Esempio n. 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;
         if ($this->isNew() || $this->isModified()) {
             // persist changes
             if ($this->isNew()) {
                 $this->doInsert($con);
                 $affectedRows += 1;
             } else {
                 $affectedRows += $this->doUpdate($con);
             }
             $this->resetModified();
         }
         if ($this->galleriesScheduledForDeletion !== null) {
             if (!$this->galleriesScheduledForDeletion->isEmpty()) {
                 $pks = array();
                 foreach ($this->galleriesScheduledForDeletion as $entry) {
                     $entryPk = [];
                     $entryPk[0] = $this->getId();
                     $entryPk[1] = $entry->getId();
                     $pks[] = $entryPk;
                 }
                 \Models\ImageGalleryMapQuery::create()->filterByPrimaryKeys($pks)->delete($con);
                 $this->galleriesScheduledForDeletion = null;
             }
         }
         if ($this->collGalleries) {
             foreach ($this->collGalleries as $gallery) {
                 if (!$gallery->isDeleted() && ($gallery->isNew() || $gallery->isModified())) {
                     $gallery->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);
                 }
             }
         }
         if ($this->articlesScheduledForDeletion !== null) {
             if (!$this->articlesScheduledForDeletion->isEmpty()) {
                 foreach ($this->articlesScheduledForDeletion as $article) {
                     // need to save related object because we set the relation to null
                     $article->save($con);
                 }
                 $this->articlesScheduledForDeletion = null;
             }
         }
         if ($this->collArticles !== null) {
             foreach ($this->collArticles as $referrerFK) {
                 if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) {
                     $affectedRows += $referrerFK->save($con);
                 }
             }
         }
         if ($this->imageGalleryMapsScheduledForDeletion !== null) {
             if (!$this->imageGalleryMapsScheduledForDeletion->isEmpty()) {
                 \Models\ImageGalleryMapQuery::create()->filterByPrimaryKeys($this->imageGalleryMapsScheduledForDeletion->getPrimaryKeys(false))->delete($con);
                 $this->imageGalleryMapsScheduledForDeletion = null;
             }
         }
         if ($this->collImageGalleryMaps !== null) {
             foreach ($this->collImageGalleryMaps as $referrerFK) {
                 if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) {
                     $affectedRows += $referrerFK->save($con);
                 }
             }
         }
         $this->alreadyInSave = false;
     }
     return $affectedRows;
 }
Esempio n. 4
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;
         if ($this->isNew() || $this->isModified()) {
             // persist changes
             if ($this->isNew()) {
                 $this->doInsert($con);
             } else {
                 $this->doUpdate($con);
             }
             $affectedRows += 1;
             $this->resetModified();
         }
         if ($this->notificationOptionsScheduledForDeletion !== null) {
             if (!$this->notificationOptionsScheduledForDeletion->isEmpty()) {
                 \ORM\NotificationOptionQuery::create()->filterByPrimaryKeys($this->notificationOptionsScheduledForDeletion->getPrimaryKeys(false))->delete($con);
                 $this->notificationOptionsScheduledForDeletion = null;
             }
         }
         if ($this->collNotificationOptions !== null) {
             foreach ($this->collNotificationOptions as $referrerFK) {
                 if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) {
                     $affectedRows += $referrerFK->save($con);
                 }
             }
         }
         if ($this->singlePermission !== null) {
             if (!$this->singlePermission->isDeleted() && ($this->singlePermission->isNew() || $this->singlePermission->isModified())) {
                 $affectedRows += $this->singlePermission->save($con);
             }
         }
         if ($this->usersScheduledForDeletion !== null) {
             if (!$this->usersScheduledForDeletion->isEmpty()) {
                 \ORM\UserQuery::create()->filterByPrimaryKeys($this->usersScheduledForDeletion->getPrimaryKeys(false))->delete($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;
 }
Esempio n. 5
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;
         if ($this->isNew() || $this->isModified()) {
             // persist changes
             if ($this->isNew()) {
                 $this->doInsert($con);
             } else {
                 $this->doUpdate($con);
             }
             $affectedRows += 1;
             $this->resetModified();
         }
         if ($this->usersScheduledForDeletion !== null) {
             if (!$this->usersScheduledForDeletion->isEmpty()) {
                 $pks = array();
                 foreach ($this->usersScheduledForDeletion as $entry) {
                     $entryPk = [];
                     $entryPk[1] = $this->getId();
                     $entryPk[0] = $entry->getId();
                     $pks[] = $entryPk;
                 }
                 \Alchemy\Component\Cerberus\Model\UserRoleQuery::create()->filterByPrimaryKeys($pks)->delete($con);
                 $this->usersScheduledForDeletion = null;
             }
         }
         if ($this->collUsers) {
             foreach ($this->collUsers as $user) {
                 if (!$user->isDeleted() && ($user->isNew() || $user->isModified())) {
                     $user->save($con);
                 }
             }
         }
         if ($this->permissionsScheduledForDeletion !== null) {
             if (!$this->permissionsScheduledForDeletion->isEmpty()) {
                 $pks = array();
                 foreach ($this->permissionsScheduledForDeletion as $entry) {
                     $entryPk = [];
                     $entryPk[0] = $this->getId();
                     $entryPk[1] = $entry->getId();
                     $pks[] = $entryPk;
                 }
                 \Alchemy\Component\Cerberus\Model\RolePermissionQuery::create()->filterByPrimaryKeys($pks)->delete($con);
                 $this->permissionsScheduledForDeletion = null;
             }
         }
         if ($this->collPermissions) {
             foreach ($this->collPermissions as $permission) {
                 if (!$permission->isDeleted() && ($permission->isNew() || $permission->isModified())) {
                     $permission->save($con);
                 }
             }
         }
         if ($this->userRolesScheduledForDeletion !== null) {
             if (!$this->userRolesScheduledForDeletion->isEmpty()) {
                 \Alchemy\Component\Cerberus\Model\UserRoleQuery::create()->filterByPrimaryKeys($this->userRolesScheduledForDeletion->getPrimaryKeys(false))->delete($con);
                 $this->userRolesScheduledForDeletion = null;
             }
         }
         if ($this->collUserRoles !== null) {
             foreach ($this->collUserRoles as $referrerFK) {
                 if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) {
                     $affectedRows += $referrerFK->save($con);
                 }
             }
         }
         if ($this->rolePermissionsScheduledForDeletion !== null) {
             if (!$this->rolePermissionsScheduledForDeletion->isEmpty()) {
                 \Alchemy\Component\Cerberus\Model\RolePermissionQuery::create()->filterByPrimaryKeys($this->rolePermissionsScheduledForDeletion->getPrimaryKeys(false))->delete($con);
                 $this->rolePermissionsScheduledForDeletion = null;
             }
         }
         if ($this->collRolePermissions !== null) {
             foreach ($this->collRolePermissions 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->usersScheduledForDeletion !== null) {
             if (!$this->usersScheduledForDeletion->isEmpty()) {
                 \Jalle19\StatusManager\Database\UserQuery::create()->filterByPrimaryKeys($this->usersScheduledForDeletion->getPrimaryKeys(false))->delete($con);
                 $this->usersScheduledForDeletion = null;
             }
         }
         if ($this->collUsers !== null) {
             foreach ($this->collUsers as $referrerFK) {
                 if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) {
                     $affectedRows += $referrerFK->save($con);
                 }
             }
         }
         if ($this->connectionsScheduledForDeletion !== null) {
             if (!$this->connectionsScheduledForDeletion->isEmpty()) {
                 \Jalle19\StatusManager\Database\ConnectionQuery::create()->filterByPrimaryKeys($this->connectionsScheduledForDeletion->getPrimaryKeys(false))->delete($con);
                 $this->connectionsScheduledForDeletion = null;
             }
         }
         if ($this->collConnections !== null) {
             foreach ($this->collConnections as $referrerFK) {
                 if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) {
                     $affectedRows += $referrerFK->save($con);
                 }
             }
         }
         if ($this->inputsScheduledForDeletion !== null) {
             if (!$this->inputsScheduledForDeletion->isEmpty()) {
                 \Jalle19\StatusManager\Database\InputQuery::create()->filterByPrimaryKeys($this->inputsScheduledForDeletion->getPrimaryKeys(false))->delete($con);
                 $this->inputsScheduledForDeletion = null;
             }
         }
         if ($this->collInputs !== null) {
             foreach ($this->collInputs as $referrerFK) {
                 if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) {
                     $affectedRows += $referrerFK->save($con);
                 }
             }
         }
         if ($this->channelsScheduledForDeletion !== null) {
             if (!$this->channelsScheduledForDeletion->isEmpty()) {
                 \Jalle19\StatusManager\Database\ChannelQuery::create()->filterByPrimaryKeys($this->channelsScheduledForDeletion->getPrimaryKeys(false))->delete($con);
                 $this->channelsScheduledForDeletion = null;
             }
         }
         if ($this->collChannels !== null) {
             foreach ($this->collChannels as $referrerFK) {
                 if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) {
                     $affectedRows += $referrerFK->save($con);
                 }
             }
         }
         if ($this->subscriptionsScheduledForDeletion !== null) {
             if (!$this->subscriptionsScheduledForDeletion->isEmpty()) {
                 \Jalle19\StatusManager\Database\SubscriptionQuery::create()->filterByPrimaryKeys($this->subscriptionsScheduledForDeletion->getPrimaryKeys(false))->delete($con);
                 $this->subscriptionsScheduledForDeletion = null;
             }
         }
         if ($this->collSubscriptions !== null) {
             foreach ($this->collSubscriptions as $referrerFK) {
                 if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) {
                     $affectedRows += $referrerFK->save($con);
                 }
             }
         }
         $this->alreadyInSave = false;
     }
     return $affectedRows;
 }
Esempio n. 7
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->aUserRelatedBySubmitter !== null) {
             if ($this->aUserRelatedBySubmitter->isModified() || $this->aUserRelatedBySubmitter->isNew()) {
                 $affectedRows += $this->aUserRelatedBySubmitter->save($con);
             }
             $this->setUserRelatedBySubmitter($this->aUserRelatedBySubmitter);
         }
         if ($this->isNew() || $this->isModified()) {
             // persist changes
             if ($this->isNew()) {
                 $this->doInsert($con);
                 $affectedRows += 1;
             } else {
                 $affectedRows += $this->doUpdate($con);
             }
             $this->resetModified();
         }
         if ($this->usersScheduledForDeletion !== null) {
             if (!$this->usersScheduledForDeletion->isEmpty()) {
                 $pks = array();
                 foreach ($this->usersScheduledForDeletion as $entry) {
                     $entryPk = [];
                     $entryPk[1] = $this->getIdWine();
                     $entryPk[0] = $entry->getIdUser();
                     $pks[] = $entryPk;
                 }
                 \WineTasting\Model\TastedWineQuery::create()->filterByPrimaryKeys($pks)->delete($con);
                 $this->usersScheduledForDeletion = null;
             }
         }
         if ($this->collUsers) {
             foreach ($this->collUsers as $user) {
                 if (!$user->isDeleted() && ($user->isNew() || $user->isModified())) {
                     $user->save($con);
                 }
             }
         }
         if ($this->usersRelatedByVote1ScheduledForDeletion !== null) {
             if (!$this->usersRelatedByVote1ScheduledForDeletion->isEmpty()) {
                 foreach ($this->usersRelatedByVote1ScheduledForDeletion as $userRelatedByVote1) {
                     // need to save related object because we set the relation to null
                     $userRelatedByVote1->save($con);
                 }
                 $this->usersRelatedByVote1ScheduledForDeletion = null;
             }
         }
         if ($this->collUsersRelatedByVote1 !== null) {
             foreach ($this->collUsersRelatedByVote1 as $referrerFK) {
                 if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) {
                     $affectedRows += $referrerFK->save($con);
                 }
             }
         }
         if ($this->usersRelatedByVote2ScheduledForDeletion !== null) {
             if (!$this->usersRelatedByVote2ScheduledForDeletion->isEmpty()) {
                 foreach ($this->usersRelatedByVote2ScheduledForDeletion as $userRelatedByVote2) {
                     // need to save related object because we set the relation to null
                     $userRelatedByVote2->save($con);
                 }
                 $this->usersRelatedByVote2ScheduledForDeletion = null;
             }
         }
         if ($this->collUsersRelatedByVote2 !== null) {
             foreach ($this->collUsersRelatedByVote2 as $referrerFK) {
                 if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) {
                     $affectedRows += $referrerFK->save($con);
                 }
             }
         }
         if ($this->usersRelatedByVote3ScheduledForDeletion !== null) {
             if (!$this->usersRelatedByVote3ScheduledForDeletion->isEmpty()) {
                 foreach ($this->usersRelatedByVote3ScheduledForDeletion as $userRelatedByVote3) {
                     // need to save related object because we set the relation to null
                     $userRelatedByVote3->save($con);
                 }
                 $this->usersRelatedByVote3ScheduledForDeletion = null;
             }
         }
         if ($this->collUsersRelatedByVote3 !== null) {
             foreach ($this->collUsersRelatedByVote3 as $referrerFK) {
                 if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) {
                     $affectedRows += $referrerFK->save($con);
                 }
             }
         }
         if ($this->tastedWinesScheduledForDeletion !== null) {
             if (!$this->tastedWinesScheduledForDeletion->isEmpty()) {
                 \WineTasting\Model\TastedWineQuery::create()->filterByPrimaryKeys($this->tastedWinesScheduledForDeletion->getPrimaryKeys(false))->delete($con);
                 $this->tastedWinesScheduledForDeletion = null;
             }
         }
         if ($this->collTastedWines !== null) {
             foreach ($this->collTastedWines as $referrerFK) {
                 if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) {
                     $affectedRows += $referrerFK->save($con);
                 }
             }
         }
         $this->alreadyInSave = false;
     }
     return $affectedRows;
 }