Beispiel #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->aSport !== null) {
             if ($this->aSport->isModified() || $this->aSport->isNew()) {
                 $affectedRows += $this->aSport->save($con);
             }
             $this->setSport($this->aSport);
         }
         if ($this->isNew() || $this->isModified()) {
             // persist changes
             if ($this->isNew()) {
                 $this->doInsert($con);
                 $affectedRows += 1;
             } else {
                 $affectedRows += $this->doUpdate($con);
             }
             $this->resetModified();
         }
         if ($this->skillsScheduledForDeletion !== null) {
             if (!$this->skillsScheduledForDeletion->isEmpty()) {
                 $pks = array();
                 foreach ($this->skillsScheduledForDeletion as $entry) {
                     $entryPk = [];
                     $entryPk[1] = $this->getId();
                     $entryPk[0] = $entry->getId();
                     $pks[] = $entryPk;
                 }
                 \gossi\trixionary\model\SkillGroupQuery::create()->filterByPrimaryKeys($pks)->delete($con);
                 $this->skillsScheduledForDeletion = null;
             }
         }
         if ($this->collSkills) {
             foreach ($this->collSkills as $skill) {
                 if (!$skill->isDeleted() && ($skill->isNew() || $skill->isModified())) {
                     $skill->save($con);
                 }
             }
         }
         if ($this->skillGroupsScheduledForDeletion !== null) {
             if (!$this->skillGroupsScheduledForDeletion->isEmpty()) {
                 \gossi\trixionary\model\SkillGroupQuery::create()->filterByPrimaryKeys($this->skillGroupsScheduledForDeletion->getPrimaryKeys(false))->delete($con);
                 $this->skillGroupsScheduledForDeletion = null;
             }
         }
         if ($this->collSkillGroups !== null) {
             foreach ($this->collSkillGroups as $referrerFK) {
                 if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) {
                     $affectedRows += $referrerFK->save($con);
                 }
             }
         }
         $this->alreadyInSave = false;
     }
     return $affectedRows;
 }
Beispiel #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->objectsScheduledForDeletion !== null) {
             if (!$this->objectsScheduledForDeletion->isEmpty()) {
                 \gossi\trixionary\model\ObjectQuery::create()->filterByPrimaryKeys($this->objectsScheduledForDeletion->getPrimaryKeys(false))->delete($con);
                 $this->objectsScheduledForDeletion = null;
             }
         }
         if ($this->collObjects !== null) {
             foreach ($this->collObjects as $referrerFK) {
                 if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) {
                     $affectedRows += $referrerFK->save($con);
                 }
             }
         }
         if ($this->positionsScheduledForDeletion !== null) {
             if (!$this->positionsScheduledForDeletion->isEmpty()) {
                 \gossi\trixionary\model\PositionQuery::create()->filterByPrimaryKeys($this->positionsScheduledForDeletion->getPrimaryKeys(false))->delete($con);
                 $this->positionsScheduledForDeletion = null;
             }
         }
         if ($this->collPositions !== null) {
             foreach ($this->collPositions as $referrerFK) {
                 if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) {
                     $affectedRows += $referrerFK->save($con);
                 }
             }
         }
         if ($this->skillsScheduledForDeletion !== null) {
             if (!$this->skillsScheduledForDeletion->isEmpty()) {
                 \gossi\trixionary\model\SkillQuery::create()->filterByPrimaryKeys($this->skillsScheduledForDeletion->getPrimaryKeys(false))->delete($con);
                 $this->skillsScheduledForDeletion = null;
             }
         }
         if ($this->collSkills !== null) {
             foreach ($this->collSkills as $referrerFK) {
                 if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) {
                     $affectedRows += $referrerFK->save($con);
                 }
             }
         }
         if ($this->groupsScheduledForDeletion !== null) {
             if (!$this->groupsScheduledForDeletion->isEmpty()) {
                 \gossi\trixionary\model\GroupQuery::create()->filterByPrimaryKeys($this->groupsScheduledForDeletion->getPrimaryKeys(false))->delete($con);
                 $this->groupsScheduledForDeletion = null;
             }
         }
         if ($this->collGroups !== null) {
             foreach ($this->collGroups as $referrerFK) {
                 if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) {
                     $affectedRows += $referrerFK->save($con);
                 }
             }
         }
         $this->alreadyInSave = false;
     }
     return $affectedRows;
 }
Beispiel #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;
         // 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->aStructureNode !== null) {
             if ($this->aStructureNode->isModified() || $this->aStructureNode->isNew()) {
                 $affectedRows += $this->aStructureNode->save($con);
             }
             $this->setStructureNode($this->aStructureNode);
         }
         if ($this->aSkillRelatedBySkillId !== null) {
             if ($this->aSkillRelatedBySkillId->isModified() || $this->aSkillRelatedBySkillId->isNew()) {
                 $affectedRows += $this->aSkillRelatedBySkillId->save($con);
             }
             $this->setSkillRelatedBySkillId($this->aSkillRelatedBySkillId);
         }
         if ($this->isNew() || $this->isModified()) {
             // persist changes
             if ($this->isNew()) {
                 $this->doInsert($con);
                 $affectedRows += 1;
             } else {
                 $affectedRows += $this->doUpdate($con);
             }
             $this->resetModified();
         }
         if ($this->rootSkillsScheduledForDeletion !== null) {
             if (!$this->rootSkillsScheduledForDeletion->isEmpty()) {
                 foreach ($this->rootSkillsScheduledForDeletion as $rootSkill) {
                     // need to save related object because we set the relation to null
                     $rootSkill->save($con);
                 }
                 $this->rootSkillsScheduledForDeletion = null;
             }
         }
         if ($this->collRootSkills !== null) {
             foreach ($this->collRootSkills as $referrerFK) {
                 if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) {
                     $affectedRows += $referrerFK->save($con);
                 }
             }
         }
         $this->alreadyInSave = false;
     }
     return $affectedRows;
 }
Beispiel #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);
                 $affectedRows += 1;
             } else {
                 $affectedRows += $this->doUpdate($con);
             }
             $this->resetModified();
         }
         if ($this->skillsScheduledForDeletion !== null) {
             if (!$this->skillsScheduledForDeletion->isEmpty()) {
                 $pks = array();
                 foreach ($this->skillsScheduledForDeletion as $entry) {
                     $entryPk = [];
                     $entryPk[1] = $this->getId();
                     $entryPk[0] = $entry->getId();
                     $pks[] = $entryPk;
                 }
                 \gossi\trixionary\model\SkillReferenceQuery::create()->filterByPrimaryKeys($pks)->delete($con);
                 $this->skillsScheduledForDeletion = null;
             }
         }
         if ($this->collSkills) {
             foreach ($this->collSkills as $skill) {
                 if (!$skill->isDeleted() && ($skill->isNew() || $skill->isModified())) {
                     $skill->save($con);
                 }
             }
         }
         if ($this->videosScheduledForDeletion !== null) {
             if (!$this->videosScheduledForDeletion->isEmpty()) {
                 foreach ($this->videosScheduledForDeletion as $video) {
                     // need to save related object because we set the relation to null
                     $video->save($con);
                 }
                 $this->videosScheduledForDeletion = null;
             }
         }
         if ($this->collVideos !== null) {
             foreach ($this->collVideos as $referrerFK) {
                 if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) {
                     $affectedRows += $referrerFK->save($con);
                 }
             }
         }
         if ($this->skillReferencesScheduledForDeletion !== null) {
             if (!$this->skillReferencesScheduledForDeletion->isEmpty()) {
                 \gossi\trixionary\model\SkillReferenceQuery::create()->filterByPrimaryKeys($this->skillReferencesScheduledForDeletion->getPrimaryKeys(false))->delete($con);
                 $this->skillReferencesScheduledForDeletion = null;
             }
         }
         if ($this->collSkillReferences !== null) {
             foreach ($this->collSkillReferences as $referrerFK) {
                 if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) {
                     $affectedRows += $referrerFK->save($con);
                 }
             }
         }
         $this->alreadyInSave = false;
     }
     return $affectedRows;
 }