/** * 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->invTypessScheduledForDeletion !== null) { if (!$this->invTypessScheduledForDeletion->isEmpty()) { $pks = array(); foreach ($this->invTypessScheduledForDeletion as $entry) { $entryPk = []; $entryPk[1] = $this->getEffectid(); $entryPk[0] = $entry->getTypeid(); $pks[] = $entryPk; } \EVE\DgmTypeEffectsQuery::create()->filterByPrimaryKeys($pks)->delete($con); $this->invTypessScheduledForDeletion = null; } } if ($this->collInvTypess) { foreach ($this->collInvTypess as $invTypes) { if (!$invTypes->isDeleted() && ($invTypes->isNew() || $invTypes->isModified())) { $invTypes->save($con); } } } if ($this->dgmTypeEffectssScheduledForDeletion !== null) { if (!$this->dgmTypeEffectssScheduledForDeletion->isEmpty()) { \EVE\DgmTypeEffectsQuery::create()->filterByPrimaryKeys($this->dgmTypeEffectssScheduledForDeletion->getPrimaryKeys(false))->delete($con); $this->dgmTypeEffectssScheduledForDeletion = null; } } if ($this->collDgmTypeEffectss !== null) { foreach ($this->collDgmTypeEffectss 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->aInvCategories !== null) { if ($this->aInvCategories->isModified() || $this->aInvCategories->isNew()) { $affectedRows += $this->aInvCategories->save($con); } $this->setInvCategories($this->aInvCategories); } if ($this->isNew() || $this->isModified()) { // persist changes if ($this->isNew()) { $this->doInsert($con); $affectedRows += 1; } else { $affectedRows += $this->doUpdate($con); } $this->resetModified(); } if ($this->invTypessScheduledForDeletion !== null) { if (!$this->invTypessScheduledForDeletion->isEmpty()) { \EVE\InvTypesQuery::create()->filterByPrimaryKeys($this->invTypessScheduledForDeletion->getPrimaryKeys(false))->delete($con); $this->invTypessScheduledForDeletion = null; } } if ($this->collInvTypess !== null) { foreach ($this->collInvTypess as $referrerFK) { if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) { $affectedRows += $referrerFK->save($con); } } } $this->alreadyInSave = false; } return $affectedRows; }