/** * 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 PropelPDO $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(PropelPDO $con) { $affectedRows = 0; // initialize var to track total num of affected rows if (!$this->alreadyInSave) { $this->alreadyInSave = true; if ($this->isNew()) { $this->modifiedColumns[] = sfGuardUserPeer::ID; } // If this object has been modified, then save it to the database. if ($this->isModified()) { if ($this->isNew()) { $pk = sfGuardUserPeer::doInsert($this, $con); $affectedRows += 1; // we are assuming that there is only 1 row per doInsert() which // should always be true here (even though technically // BasePeer::doInsert() can insert multiple rows). $this->setId($pk); //[IMV] update autoincrement primary key $this->setNew(false); } else { $affectedRows += sfGuardUserPeer::doUpdate($this, $con); } $this->resetModified(); // [HL] After being saved an object is no longer 'modified' } if ($this->collsfGuardUserPermissions !== null) { foreach ($this->collsfGuardUserPermissions as $referrerFK) { if (!$referrerFK->isDeleted()) { $affectedRows += $referrerFK->save($con); } } } if ($this->collsfGuardUserGroups !== null) { foreach ($this->collsfGuardUserGroups as $referrerFK) { if (!$referrerFK->isDeleted()) { $affectedRows += $referrerFK->save($con); } } } if ($this->collsfGuardRememberKeys !== null) { foreach ($this->collsfGuardRememberKeys as $referrerFK) { if (!$referrerFK->isDeleted()) { $affectedRows += $referrerFK->save($con); } } } if ($this->collEnlaces !== null) { foreach ($this->collEnlaces as $referrerFK) { if (!$referrerFK->isDeleted()) { $affectedRows += $referrerFK->save($con); } } } if ($this->collPropuestas !== null) { foreach ($this->collPropuestas as $referrerFK) { if (!$referrerFK->isDeleted()) { $affectedRows += $referrerFK->save($con); } } } if ($this->collPoliticos !== null) { foreach ($this->collPoliticos as $referrerFK) { if (!$referrerFK->isDeleted()) { $affectedRows += $referrerFK->save($con); } } } if ($this->collSfGuardUserProfiles !== null) { foreach ($this->collSfGuardUserProfiles as $referrerFK) { if (!$referrerFK->isDeleted()) { $affectedRows += $referrerFK->save($con); } } } if ($this->collEtiquetaPoliticos !== null) { foreach ($this->collEtiquetaPoliticos as $referrerFK) { if (!$referrerFK->isDeleted()) { $affectedRows += $referrerFK->save($con); } } } if ($this->collEtiquetaPartidos !== null) { foreach ($this->collEtiquetaPartidos as $referrerFK) { if (!$referrerFK->isDeleted()) { $affectedRows += $referrerFK->save($con); } } } if ($this->collEtiquetaPropuestas !== null) { foreach ($this->collEtiquetaPropuestas as $referrerFK) { if (!$referrerFK->isDeleted()) { $affectedRows += $referrerFK->save($con); } } } if ($this->collSfApplications !== null) { foreach ($this->collSfApplications as $referrerFK) { if (!$referrerFK->isDeleted()) { $affectedRows += $referrerFK->save($con); } } } if ($this->collSfReviews !== null) { foreach ($this->collSfReviews as $referrerFK) { if (!$referrerFK->isDeleted()) { $affectedRows += $referrerFK->save($con); } } } $this->alreadyInSave = false; } return $affectedRows; }
protected function doSave($con) { $affectedRows = 0; if (!$this->alreadyInSave) { $this->alreadyInSave = true; if ($this->isModified()) { if ($this->isNew()) { $pk = sfGuardUserPeer::doInsert($this, $con); $affectedRows += 1; $this->setId($pk); $this->setNew(false); } else { $affectedRows += sfGuardUserPeer::doUpdate($this, $con); } $this->resetModified(); } if ($this->collsfGuardUserProfiles !== null) { foreach ($this->collsfGuardUserProfiles as $referrerFK) { if (!$referrerFK->isDeleted()) { $affectedRows += $referrerFK->save($con); } } } if ($this->collsfGuardUserPermissions !== null) { foreach ($this->collsfGuardUserPermissions as $referrerFK) { if (!$referrerFK->isDeleted()) { $affectedRows += $referrerFK->save($con); } } } if ($this->collsfGuardUserGroups !== null) { foreach ($this->collsfGuardUserGroups as $referrerFK) { if (!$referrerFK->isDeleted()) { $affectedRows += $referrerFK->save($con); } } } if ($this->collsfGuardRememberKeys !== null) { foreach ($this->collsfGuardRememberKeys as $referrerFK) { if (!$referrerFK->isDeleted()) { $affectedRows += $referrerFK->save($con); } } } $this->alreadyInSave = false; } return $affectedRows; }
protected function doSave($con) { $affectedRows = 0; if (!$this->alreadyInSave) { $this->alreadyInSave = true; if ($this->isModified()) { if ($this->isNew()) { $pk = sfGuardUserPeer::doInsert($this, $con); $affectedRows += 1; $this->setId($pk); $this->setNew(false); } else { $affectedRows += sfGuardUserPeer::doUpdate($this, $con); } $this->resetModified(); } if ($this->collsfGuardUserPermissions !== null) { foreach ($this->collsfGuardUserPermissions as $referrerFK) { if (!$referrerFK->isDeleted()) { $affectedRows += $referrerFK->save($con); } } } if ($this->collsfGuardUserGroups !== null) { foreach ($this->collsfGuardUserGroups as $referrerFK) { if (!$referrerFK->isDeleted()) { $affectedRows += $referrerFK->save($con); } } } if ($this->collsfGuardRememberKeys !== null) { foreach ($this->collsfGuardRememberKeys as $referrerFK) { if (!$referrerFK->isDeleted()) { $affectedRows += $referrerFK->save($con); } } } if ($this->collsfTickets !== null) { foreach ($this->collsfTickets as $referrerFK) { if (!$referrerFK->isDeleted()) { $affectedRows += $referrerFK->save($con); } } } if ($this->collsfTicketThreads !== null) { foreach ($this->collsfTicketThreads as $referrerFK) { if (!$referrerFK->isDeleted()) { $affectedRows += $referrerFK->save($con); } } } if ($this->collsfUserRecommendations !== null) { foreach ($this->collsfUserRecommendations as $referrerFK) { if (!$referrerFK->isDeleted()) { $affectedRows += $referrerFK->save($con); } } } if ($this->collsfGuardUserProfiles !== null) { foreach ($this->collsfGuardUserProfiles as $referrerFK) { if (!$referrerFK->isDeleted()) { $affectedRows += $referrerFK->save($con); } } } if ($this->collExternalServices !== null) { foreach ($this->collExternalServices as $referrerFK) { if (!$referrerFK->isDeleted()) { $affectedRows += $referrerFK->save($con); } } } if ($this->collUserSettings !== null) { foreach ($this->collUserSettings as $referrerFK) { if (!$referrerFK->isDeleted()) { $affectedRows += $referrerFK->save($con); } } } if ($this->collContactInfos !== null) { foreach ($this->collContactInfos as $referrerFK) { if (!$referrerFK->isDeleted()) { $affectedRows += $referrerFK->save($con); } } } if ($this->collProjectsRelatedByCreatedBy !== null) { foreach ($this->collProjectsRelatedByCreatedBy as $referrerFK) { if (!$referrerFK->isDeleted()) { $affectedRows += $referrerFK->save($con); } } } if ($this->collProjectsRelatedByOwnerId !== null) { foreach ($this->collProjectsRelatedByOwnerId as $referrerFK) { if (!$referrerFK->isDeleted()) { $affectedRows += $referrerFK->save($con); } } } if ($this->collProjectApplicationsRelatedByCreatedBy !== null) { foreach ($this->collProjectApplicationsRelatedByCreatedBy as $referrerFK) { if (!$referrerFK->isDeleted()) { $affectedRows += $referrerFK->save($con); } } } if ($this->collProjectApplicationsRelatedByOwnerId !== null) { foreach ($this->collProjectApplicationsRelatedByOwnerId as $referrerFK) { if (!$referrerFK->isDeleted()) { $affectedRows += $referrerFK->save($con); } } } if ($this->collUserVotes !== null) { foreach ($this->collUserVotes as $referrerFK) { if (!$referrerFK->isDeleted()) { $affectedRows += $referrerFK->save($con); } } } if ($this->collProjectPositions !== null) { foreach ($this->collProjectPositions as $referrerFK) { if (!$referrerFK->isDeleted()) { $affectedRows += $referrerFK->save($con); } } } if ($this->collProjectUsers !== null) { foreach ($this->collProjectUsers as $referrerFK) { if (!$referrerFK->isDeleted()) { $affectedRows += $referrerFK->save($con); } } } if ($this->collTaskUsers !== null) { foreach ($this->collTaskUsers as $referrerFK) { if (!$referrerFK->isDeleted()) { $affectedRows += $referrerFK->save($con); } } } if ($this->collTasks !== null) { foreach ($this->collTasks as $referrerFK) { if (!$referrerFK->isDeleted()) { $affectedRows += $referrerFK->save($con); } } } if ($this->collToDos !== null) { foreach ($this->collToDos as $referrerFK) { if (!$referrerFK->isDeleted()) { $affectedRows += $referrerFK->save($con); } } } if ($this->collMessagesRelatedByOwnerId !== null) { foreach ($this->collMessagesRelatedByOwnerId as $referrerFK) { if (!$referrerFK->isDeleted()) { $affectedRows += $referrerFK->save($con); } } } if ($this->collMessagesRelatedBySenderId !== null) { foreach ($this->collMessagesRelatedBySenderId as $referrerFK) { if (!$referrerFK->isDeleted()) { $affectedRows += $referrerFK->save($con); } } } if ($this->collMessagesRelatedByRecipientId !== null) { foreach ($this->collMessagesRelatedByRecipientId as $referrerFK) { if (!$referrerFK->isDeleted()) { $affectedRows += $referrerFK->save($con); } } } if ($this->collHistoryGroupUsers !== null) { foreach ($this->collHistoryGroupUsers as $referrerFK) { if (!$referrerFK->isDeleted()) { $affectedRows += $referrerFK->save($con); } } } if ($this->collHistoryEvents !== null) { foreach ($this->collHistoryEvents as $referrerFK) { if (!$referrerFK->isDeleted()) { $affectedRows += $referrerFK->save($con); } } } if ($this->collSocialConnectionsRelatedByUser1Id !== null) { foreach ($this->collSocialConnectionsRelatedByUser1Id as $referrerFK) { if (!$referrerFK->isDeleted()) { $affectedRows += $referrerFK->save($con); } } } if ($this->collSocialConnectionsRelatedByUser2Id !== null) { foreach ($this->collSocialConnectionsRelatedByUser2Id as $referrerFK) { if (!$referrerFK->isDeleted()) { $affectedRows += $referrerFK->save($con); } } } if ($this->collsfFileGallerys !== null) { foreach ($this->collsfFileGallerys as $referrerFK) { if (!$referrerFK->isDeleted()) { $affectedRows += $referrerFK->save($con); } } } if ($this->collSuggestedFeatures !== null) { foreach ($this->collSuggestedFeatures as $referrerFK) { if (!$referrerFK->isDeleted()) { $affectedRows += $referrerFK->save($con); } } } if ($this->collContactCothinks !== null) { foreach ($this->collContactCothinks as $referrerFK) { if (!$referrerFK->isDeleted()) { $affectedRows += $referrerFK->save($con); } } } if ($this->collCoForms !== null) { foreach ($this->collCoForms as $referrerFK) { if (!$referrerFK->isDeleted()) { $affectedRows += $referrerFK->save($con); } } } if ($this->collCoApplications !== null) { foreach ($this->collCoApplications as $referrerFK) { if (!$referrerFK->isDeleted()) { $affectedRows += $referrerFK->save($con); } } } if ($this->collPositionApplications !== null) { foreach ($this->collPositionApplications as $referrerFK) { if (!$referrerFK->isDeleted()) { $affectedRows += $referrerFK->save($con); } } } if ($this->collsfSimpleForumTopics !== null) { foreach ($this->collsfSimpleForumTopics as $referrerFK) { if (!$referrerFK->isDeleted()) { $affectedRows += $referrerFK->save($con); } } } if ($this->collsfSimpleForumPosts !== null) { foreach ($this->collsfSimpleForumPosts as $referrerFK) { if (!$referrerFK->isDeleted()) { $affectedRows += $referrerFK->save($con); } } } if ($this->collsfSimpleForumTopicViews !== null) { foreach ($this->collsfSimpleForumTopicViews as $referrerFK) { if (!$referrerFK->isDeleted()) { $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 PropelPDO $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(PropelPDO $con) { $affectedRows = 0; // initialize var to track total num of affected rows if (!$this->alreadyInSave) { $this->alreadyInSave = true; if ($this->isNew()) { $this->modifiedColumns[] = sfGuardUserPeer::ID; } // If this object has been modified, then save it to the database. if ($this->isModified()) { if ($this->isNew()) { $criteria = $this->buildCriteria(); if ($criteria->keyContainsValue(sfGuardUserPeer::ID)) { throw new PropelException('Cannot insert a value for auto-increment primary key (' . sfGuardUserPeer::ID . ')'); } $pk = BasePeer::doInsert($criteria, $con); $affectedRows = 1; $this->setId($pk); //[IMV] update autoincrement primary key $this->setNew(false); } else { $affectedRows = sfGuardUserPeer::doUpdate($this, $con); } $this->resetModified(); // [HL] After being saved an object is no longer 'modified' } if ($this->collsfGuardUserPermissions !== null) { foreach ($this->collsfGuardUserPermissions as $referrerFK) { if (!$referrerFK->isDeleted()) { $affectedRows += $referrerFK->save($con); } } } if ($this->collsfGuardUserGroups !== null) { foreach ($this->collsfGuardUserGroups as $referrerFK) { if (!$referrerFK->isDeleted()) { $affectedRows += $referrerFK->save($con); } } } if ($this->collsfGuardRememberKeys !== null) { foreach ($this->collsfGuardRememberKeys as $referrerFK) { if (!$referrerFK->isDeleted()) { $affectedRows += $referrerFK->save($con); } } } $this->alreadyInSave = false; } return $affectedRows; }