/** * 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; }
/** * 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->eventsScheduledForDeletion !== null) { if (!$this->eventsScheduledForDeletion->isEmpty()) { \EventQuery::create()->filterByPrimaryKeys($this->eventsScheduledForDeletion->getPrimaryKeys(false))->delete($con); $this->eventsScheduledForDeletion = null; } } if ($this->collEvents !== null) { foreach ($this->collEvents as $referrerFK) { if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) { $affectedRows += $referrerFK->save($con); } } } if ($this->interestsScheduledForDeletion !== null) { if (!$this->interestsScheduledForDeletion->isEmpty()) { \EventInterestQuery::create()->filterByPrimaryKeys($this->interestsScheduledForDeletion->getPrimaryKeys(false))->delete($con); $this->interestsScheduledForDeletion = null; } } if ($this->collInterests !== null) { foreach ($this->collInterests as $referrerFK) { if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) { $affectedRows += $referrerFK->save($con); } } } if ($this->commentsScheduledForDeletion !== null) { if (!$this->commentsScheduledForDeletion->isEmpty()) { \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); } } } $this->alreadyInSave = false; } return $affectedRows; }