Example #1
0
File: Event.php Project: iuf/junia
 /**
  * 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->aPerformanceTotalStatistic !== null) {
             if ($this->aPerformanceTotalStatistic->isModified() || $this->aPerformanceTotalStatistic->isNew()) {
                 $affectedRows += $this->aPerformanceTotalStatistic->save($con);
             }
             $this->setPerformanceTotalStatistic($this->aPerformanceTotalStatistic);
         }
         if ($this->aPerformanceExecutionStatistic !== null) {
             if ($this->aPerformanceExecutionStatistic->isModified() || $this->aPerformanceExecutionStatistic->isNew()) {
                 $affectedRows += $this->aPerformanceExecutionStatistic->save($con);
             }
             $this->setPerformanceExecutionStatistic($this->aPerformanceExecutionStatistic);
         }
         if ($this->aPerformanceChoreographyStatistic !== null) {
             if ($this->aPerformanceChoreographyStatistic->isModified() || $this->aPerformanceChoreographyStatistic->isNew()) {
                 $affectedRows += $this->aPerformanceChoreographyStatistic->save($con);
             }
             $this->setPerformanceChoreographyStatistic($this->aPerformanceChoreographyStatistic);
         }
         if ($this->aPerformanceMusicAndTimingStatistic !== null) {
             if ($this->aPerformanceMusicAndTimingStatistic->isModified() || $this->aPerformanceMusicAndTimingStatistic->isNew()) {
                 $affectedRows += $this->aPerformanceMusicAndTimingStatistic->save($con);
             }
             $this->setPerformanceMusicAndTimingStatistic($this->aPerformanceMusicAndTimingStatistic);
         }
         if ($this->isNew() || $this->isModified()) {
             // persist changes
             if ($this->isNew()) {
                 $this->doInsert($con);
                 $affectedRows += 1;
             } else {
                 $affectedRows += $this->doUpdate($con);
             }
             $this->resetModified();
         }
         if ($this->startgroupsScheduledForDeletion !== null) {
             if (!$this->startgroupsScheduledForDeletion->isEmpty()) {
                 \iuf\junia\model\StartgroupQuery::create()->filterByPrimaryKeys($this->startgroupsScheduledForDeletion->getPrimaryKeys(false))->delete($con);
                 $this->startgroupsScheduledForDeletion = null;
             }
         }
         if ($this->collStartgroups !== null) {
             foreach ($this->collStartgroups as $referrerFK) {
                 if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) {
                     $affectedRows += $referrerFK->save($con);
                 }
             }
         }
         $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;
         if ($this->isNew() || $this->isModified()) {
             // persist changes
             if ($this->isNew()) {
                 $this->doInsert($con);
                 $affectedRows += 1;
             } else {
                 $affectedRows += $this->doUpdate($con);
             }
             $this->resetModified();
         }
         if ($this->startgroupsScheduledForDeletion !== null) {
             if (!$this->startgroupsScheduledForDeletion->isEmpty()) {
                 \iuf\junia\model\StartgroupQuery::create()->filterByPrimaryKeys($this->startgroupsScheduledForDeletion->getPrimaryKeys(false))->delete($con);
                 $this->startgroupsScheduledForDeletion = null;
             }
         }
         if ($this->collStartgroups !== null) {
             foreach ($this->collStartgroups 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;
         if ($this->isNew() || $this->isModified()) {
             // persist changes
             if ($this->isNew()) {
                 $this->doInsert($con);
                 $affectedRows += 1;
             } else {
                 $affectedRows += $this->doUpdate($con);
             }
             $this->resetModified();
         }
         if ($this->eventsRelatedByPerformanceTotalStatisticIdScheduledForDeletion !== null) {
             if (!$this->eventsRelatedByPerformanceTotalStatisticIdScheduledForDeletion->isEmpty()) {
                 foreach ($this->eventsRelatedByPerformanceTotalStatisticIdScheduledForDeletion as $eventRelatedByPerformanceTotalStatisticId) {
                     // need to save related object because we set the relation to null
                     $eventRelatedByPerformanceTotalStatisticId->save($con);
                 }
                 $this->eventsRelatedByPerformanceTotalStatisticIdScheduledForDeletion = null;
             }
         }
         if ($this->collEventsRelatedByPerformanceTotalStatisticId !== null) {
             foreach ($this->collEventsRelatedByPerformanceTotalStatisticId as $referrerFK) {
                 if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) {
                     $affectedRows += $referrerFK->save($con);
                 }
             }
         }
         if ($this->eventsRelatedByPerformanceExecutionStatisticIdScheduledForDeletion !== null) {
             if (!$this->eventsRelatedByPerformanceExecutionStatisticIdScheduledForDeletion->isEmpty()) {
                 foreach ($this->eventsRelatedByPerformanceExecutionStatisticIdScheduledForDeletion as $eventRelatedByPerformanceExecutionStatisticId) {
                     // need to save related object because we set the relation to null
                     $eventRelatedByPerformanceExecutionStatisticId->save($con);
                 }
                 $this->eventsRelatedByPerformanceExecutionStatisticIdScheduledForDeletion = null;
             }
         }
         if ($this->collEventsRelatedByPerformanceExecutionStatisticId !== null) {
             foreach ($this->collEventsRelatedByPerformanceExecutionStatisticId as $referrerFK) {
                 if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) {
                     $affectedRows += $referrerFK->save($con);
                 }
             }
         }
         if ($this->eventsRelatedByPerformanceChoreographyStatisticIdScheduledForDeletion !== null) {
             if (!$this->eventsRelatedByPerformanceChoreographyStatisticIdScheduledForDeletion->isEmpty()) {
                 foreach ($this->eventsRelatedByPerformanceChoreographyStatisticIdScheduledForDeletion as $eventRelatedByPerformanceChoreographyStatisticId) {
                     // need to save related object because we set the relation to null
                     $eventRelatedByPerformanceChoreographyStatisticId->save($con);
                 }
                 $this->eventsRelatedByPerformanceChoreographyStatisticIdScheduledForDeletion = null;
             }
         }
         if ($this->collEventsRelatedByPerformanceChoreographyStatisticId !== null) {
             foreach ($this->collEventsRelatedByPerformanceChoreographyStatisticId as $referrerFK) {
                 if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) {
                     $affectedRows += $referrerFK->save($con);
                 }
             }
         }
         if ($this->eventsRelatedByPerformanceMusicAndTimingStatisticIdScheduledForDeletion !== null) {
             if (!$this->eventsRelatedByPerformanceMusicAndTimingStatisticIdScheduledForDeletion->isEmpty()) {
                 foreach ($this->eventsRelatedByPerformanceMusicAndTimingStatisticIdScheduledForDeletion as $eventRelatedByPerformanceMusicAndTimingStatisticId) {
                     // need to save related object because we set the relation to null
                     $eventRelatedByPerformanceMusicAndTimingStatisticId->save($con);
                 }
                 $this->eventsRelatedByPerformanceMusicAndTimingStatisticIdScheduledForDeletion = null;
             }
         }
         if ($this->collEventsRelatedByPerformanceMusicAndTimingStatisticId !== null) {
             foreach ($this->collEventsRelatedByPerformanceMusicAndTimingStatisticId as $referrerFK) {
                 if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) {
                     $affectedRows += $referrerFK->save($con);
                 }
             }
         }
         if ($this->startgroupsRelatedByPerformanceTotalStatisticIdScheduledForDeletion !== null) {
             if (!$this->startgroupsRelatedByPerformanceTotalStatisticIdScheduledForDeletion->isEmpty()) {
                 foreach ($this->startgroupsRelatedByPerformanceTotalStatisticIdScheduledForDeletion as $startgroupRelatedByPerformanceTotalStatisticId) {
                     // need to save related object because we set the relation to null
                     $startgroupRelatedByPerformanceTotalStatisticId->save($con);
                 }
                 $this->startgroupsRelatedByPerformanceTotalStatisticIdScheduledForDeletion = null;
             }
         }
         if ($this->collStartgroupsRelatedByPerformanceTotalStatisticId !== null) {
             foreach ($this->collStartgroupsRelatedByPerformanceTotalStatisticId as $referrerFK) {
                 if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) {
                     $affectedRows += $referrerFK->save($con);
                 }
             }
         }
         if ($this->startgroupsRelatedByPerformanceExecutionStatisticIdScheduledForDeletion !== null) {
             if (!$this->startgroupsRelatedByPerformanceExecutionStatisticIdScheduledForDeletion->isEmpty()) {
                 foreach ($this->startgroupsRelatedByPerformanceExecutionStatisticIdScheduledForDeletion as $startgroupRelatedByPerformanceExecutionStatisticId) {
                     // need to save related object because we set the relation to null
                     $startgroupRelatedByPerformanceExecutionStatisticId->save($con);
                 }
                 $this->startgroupsRelatedByPerformanceExecutionStatisticIdScheduledForDeletion = null;
             }
         }
         if ($this->collStartgroupsRelatedByPerformanceExecutionStatisticId !== null) {
             foreach ($this->collStartgroupsRelatedByPerformanceExecutionStatisticId as $referrerFK) {
                 if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) {
                     $affectedRows += $referrerFK->save($con);
                 }
             }
         }
         if ($this->startgroupsRelatedByPerformanceChoreographyStatisticIdScheduledForDeletion !== null) {
             if (!$this->startgroupsRelatedByPerformanceChoreographyStatisticIdScheduledForDeletion->isEmpty()) {
                 foreach ($this->startgroupsRelatedByPerformanceChoreographyStatisticIdScheduledForDeletion as $startgroupRelatedByPerformanceChoreographyStatisticId) {
                     // need to save related object because we set the relation to null
                     $startgroupRelatedByPerformanceChoreographyStatisticId->save($con);
                 }
                 $this->startgroupsRelatedByPerformanceChoreographyStatisticIdScheduledForDeletion = null;
             }
         }
         if ($this->collStartgroupsRelatedByPerformanceChoreographyStatisticId !== null) {
             foreach ($this->collStartgroupsRelatedByPerformanceChoreographyStatisticId as $referrerFK) {
                 if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) {
                     $affectedRows += $referrerFK->save($con);
                 }
             }
         }
         if ($this->startgroupsRelatedByPerformanceMusicAndTimingStatisticIdScheduledForDeletion !== null) {
             if (!$this->startgroupsRelatedByPerformanceMusicAndTimingStatisticIdScheduledForDeletion->isEmpty()) {
                 foreach ($this->startgroupsRelatedByPerformanceMusicAndTimingStatisticIdScheduledForDeletion as $startgroupRelatedByPerformanceMusicAndTimingStatisticId) {
                     // need to save related object because we set the relation to null
                     $startgroupRelatedByPerformanceMusicAndTimingStatisticId->save($con);
                 }
                 $this->startgroupsRelatedByPerformanceMusicAndTimingStatisticIdScheduledForDeletion = null;
             }
         }
         if ($this->collStartgroupsRelatedByPerformanceMusicAndTimingStatisticId !== null) {
             foreach ($this->collStartgroupsRelatedByPerformanceMusicAndTimingStatisticId as $referrerFK) {
                 if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) {
                     $affectedRows += $referrerFK->save($con);
                 }
             }
         }
         if ($this->routinesRelatedByPerformanceTotalStatisticIdScheduledForDeletion !== null) {
             if (!$this->routinesRelatedByPerformanceTotalStatisticIdScheduledForDeletion->isEmpty()) {
                 foreach ($this->routinesRelatedByPerformanceTotalStatisticIdScheduledForDeletion as $routineRelatedByPerformanceTotalStatisticId) {
                     // need to save related object because we set the relation to null
                     $routineRelatedByPerformanceTotalStatisticId->save($con);
                 }
                 $this->routinesRelatedByPerformanceTotalStatisticIdScheduledForDeletion = null;
             }
         }
         if ($this->collRoutinesRelatedByPerformanceTotalStatisticId !== null) {
             foreach ($this->collRoutinesRelatedByPerformanceTotalStatisticId as $referrerFK) {
                 if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) {
                     $affectedRows += $referrerFK->save($con);
                 }
             }
         }
         if ($this->routinesRelatedByPerformanceExecutionStatisticIdScheduledForDeletion !== null) {
             if (!$this->routinesRelatedByPerformanceExecutionStatisticIdScheduledForDeletion->isEmpty()) {
                 foreach ($this->routinesRelatedByPerformanceExecutionStatisticIdScheduledForDeletion as $routineRelatedByPerformanceExecutionStatisticId) {
                     // need to save related object because we set the relation to null
                     $routineRelatedByPerformanceExecutionStatisticId->save($con);
                 }
                 $this->routinesRelatedByPerformanceExecutionStatisticIdScheduledForDeletion = null;
             }
         }
         if ($this->collRoutinesRelatedByPerformanceExecutionStatisticId !== null) {
             foreach ($this->collRoutinesRelatedByPerformanceExecutionStatisticId as $referrerFK) {
                 if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) {
                     $affectedRows += $referrerFK->save($con);
                 }
             }
         }
         if ($this->routinesRelatedByPerformanceChoreographyStatisticIdScheduledForDeletion !== null) {
             if (!$this->routinesRelatedByPerformanceChoreographyStatisticIdScheduledForDeletion->isEmpty()) {
                 foreach ($this->routinesRelatedByPerformanceChoreographyStatisticIdScheduledForDeletion as $routineRelatedByPerformanceChoreographyStatisticId) {
                     // need to save related object because we set the relation to null
                     $routineRelatedByPerformanceChoreographyStatisticId->save($con);
                 }
                 $this->routinesRelatedByPerformanceChoreographyStatisticIdScheduledForDeletion = null;
             }
         }
         if ($this->collRoutinesRelatedByPerformanceChoreographyStatisticId !== null) {
             foreach ($this->collRoutinesRelatedByPerformanceChoreographyStatisticId as $referrerFK) {
                 if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) {
                     $affectedRows += $referrerFK->save($con);
                 }
             }
         }
         if ($this->routinesRelatedByPerformanceMusicAndTimingStatisticIdScheduledForDeletion !== null) {
             if (!$this->routinesRelatedByPerformanceMusicAndTimingStatisticIdScheduledForDeletion->isEmpty()) {
                 foreach ($this->routinesRelatedByPerformanceMusicAndTimingStatisticIdScheduledForDeletion as $routineRelatedByPerformanceMusicAndTimingStatisticId) {
                     // need to save related object because we set the relation to null
                     $routineRelatedByPerformanceMusicAndTimingStatisticId->save($con);
                 }
                 $this->routinesRelatedByPerformanceMusicAndTimingStatisticIdScheduledForDeletion = null;
             }
         }
         if ($this->collRoutinesRelatedByPerformanceMusicAndTimingStatisticId !== null) {
             foreach ($this->collRoutinesRelatedByPerformanceMusicAndTimingStatisticId as $referrerFK) {
                 if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) {
                     $affectedRows += $referrerFK->save($con);
                 }
             }
         }
         $this->alreadyInSave = false;
     }
     return $affectedRows;
 }