本文整理汇总了PHP中UserPeer::doUpdate方法的典型用法代码示例。如果您正苦于以下问题:PHP UserPeer::doUpdate方法的具体用法?PHP UserPeer::doUpdate怎么用?PHP UserPeer::doUpdate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UserPeer
的用法示例。
在下文中一共展示了UserPeer::doUpdate方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: createUser
public static function createUser($email, $password, $type)
{
$c = new Criteria();
$c->add(UserPeer::EMAIL, $email);
$user = UserPeer::doSelectOne($c);
if (!$user) {
$user = new User();
$user->setEmail($email);
$user->setPassword(md5($password));
$newId = UserPeer::doInsert($user);
$user->setId($newId);
} else {
$user->setEmail($email);
$user->setPassword(md5($password));
if ($user->isModified()) {
UserPeer::doUpdate($user);
}
}
return self::_toUser($user);
}
示例2: doSave
/**
* 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 object has been modified, then save it to the database.
if ($this->isModified()) {
if ($this->isNew()) {
$pk = UserPeer::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 += UserPeer::doUpdate($this, $con);
}
$this->resetModified();
// [HL] After being saved an object is no longer 'modified'
}
$this->alreadyInSave = false;
}
return $affectedRows;
}
示例3: doSave
/**
* 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;
// We call the save method on the following object(s) if they
// were passed to this object by their coresponding set
// method. This object relates to these object(s) by a
// foreign key reference.
if ($this->aRole !== null) {
if ($this->aRole->isModified() || $this->aRole->isNew()) {
$affectedRows += $this->aRole->save($con);
}
$this->setRole($this->aRole);
}
if ($this->aEmployee !== null) {
if ($this->aEmployee->isModified() || $this->aEmployee->isNew()) {
$affectedRows += $this->aEmployee->save($con);
}
$this->setEmployee($this->aEmployee);
}
if ($this->isNew()) {
$this->modifiedColumns[] = UserPeer::ID;
}
// If this object has been modified, then save it to the database.
if ($this->isModified()) {
if ($this->isNew()) {
$pk = UserPeer::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 += UserPeer::doUpdate($this, $con);
}
$this->resetModified();
// [HL] After being saved an object is no longer 'modified'
}
$this->alreadyInSave = false;
}
return $affectedRows;
}
示例4: doSave
/**
* 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;
// We call the save method on the following object(s) if they
// were passed to this object by their coresponding set
// method. This object relates to these object(s) by a
// foreign key reference.
if ($this->aGame !== null) {
if ($this->aGame->isModified() || $this->aGame->isNew()) {
$affectedRows += $this->aGame->save($con);
}
$this->setGame($this->aGame);
}
// If this object has been modified, then save it to the database.
if ($this->isModified()) {
if ($this->isNew()) {
$pk = UserPeer::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->setNew(false);
} else {
$affectedRows += UserPeer::doUpdate($this, $con);
}
$this->resetModified();
// [HL] After being saved an object is no longer 'modified'
}
if ($this->collTargetsRelatedByFromUserId !== null) {
foreach ($this->collTargetsRelatedByFromUserId as $referrerFK) {
if (!$referrerFK->isDeleted()) {
$affectedRows += $referrerFK->save($con);
}
}
}
if ($this->collTargetsRelatedByToUserId !== null) {
foreach ($this->collTargetsRelatedByToUserId as $referrerFK) {
if (!$referrerFK->isDeleted()) {
$affectedRows += $referrerFK->save($con);
}
}
}
if ($this->collGameMembers !== null) {
foreach ($this->collGameMembers as $referrerFK) {
if (!$referrerFK->isDeleted()) {
$affectedRows += $referrerFK->save($con);
}
}
}
$this->alreadyInSave = false;
}
return $affectedRows;
}
示例5: doSave
/**
* 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[] = UserPeer::USER_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(UserPeer::USER_ID)) {
throw new PropelException('Cannot insert a value for auto-increment primary key (' . UserPeer::USER_ID . ')');
}
$pk = BasePeer::doInsert($criteria, $con);
$affectedRows = 1;
$this->setUserId($pk);
//[IMV] update autoincrement primary key
$this->setNew(false);
} else {
$affectedRows = UserPeer::doUpdate($this, $con);
}
$this->resetModified();
// [HL] After being saved an object is no longer 'modified'
}
$this->alreadyInSave = false;
}
return $affectedRows;
}
示例6: doSave
protected function doSave($con)
{
$affectedRows = 0;
if (!$this->alreadyInSave) {
$this->alreadyInSave = true;
if ($this->isModified()) {
if ($this->isNew()) {
$pk = UserPeer::doInsert($this, $con);
$affectedRows += 1;
$this->setNew(false);
} else {
$affectedRows += UserPeer::doUpdate($this, $con);
}
$this->resetModified();
}
$this->alreadyInSave = false;
}
return $affectedRows;
}
示例7: doSave
/**
* 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[] = UserPeer::ID;
}
// If this object has been modified, then save it to the database.
if ($this->isModified()) {
if ($this->isNew()) {
$pk = UserPeer::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 += UserPeer::doUpdate($this, $con);
}
// Rewind the photograph LOB column, since PDO does not rewind after inserting value.
if ($this->photograph !== null && is_resource($this->photograph)) {
rewind($this->photograph);
}
$this->resetModified();
// [HL] After being saved an object is no longer 'modified'
}
if ($this->collMessagesRelatedByRecipientId !== null) {
foreach ($this->collMessagesRelatedByRecipientId 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->collMessagesRelatedByOwnerId !== null) {
foreach ($this->collMessagesRelatedByOwnerId as $referrerFK) {
if (!$referrerFK->isDeleted()) {
$affectedRows += $referrerFK->save($con);
}
}
}
if ($this->collReservations !== null) {
foreach ($this->collReservations as $referrerFK) {
if (!$referrerFK->isDeleted()) {
$affectedRows += $referrerFK->save($con);
}
}
}
if ($this->collReservationOtherMemberss !== null) {
foreach ($this->collReservationOtherMemberss as $referrerFK) {
if (!$referrerFK->isDeleted()) {
$affectedRows += $referrerFK->save($con);
}
}
}
if ($this->collSubscriptions !== null) {
foreach ($this->collSubscriptions as $referrerFK) {
if (!$referrerFK->isDeleted()) {
$affectedRows += $referrerFK->save($con);
}
}
}
if ($this->collUsergroupHasChiefs !== null) {
foreach ($this->collUsergroupHasChiefs as $referrerFK) {
if (!$referrerFK->isDeleted()) {
$affectedRows += $referrerFK->save($con);
}
}
}
if ($this->collUsergroupHasUsers !== null) {
foreach ($this->collUsergroupHasUsers as $referrerFK) {
if (!$referrerFK->isDeleted()) {
$affectedRows += $referrerFK->save($con);
}
}
}
if ($this->collUserHasRoles !== null) {
foreach ($this->collUserHasRoles as $referrerFK) {
if (!$referrerFK->isDeleted()) {
//.........这里部分代码省略.........
示例8: doSave
protected function doSave($con)
{
$affectedRows = 0;
if (!$this->alreadyInSave) {
$this->alreadyInSave = true;
if ($this->isModified()) {
if ($this->isNew()) {
$pk = UserPeer::doInsert($this, $con);
$affectedRows += 1;
$this->setId($pk);
$this->setNew(false);
} else {
$affectedRows += UserPeer::doUpdate($this, $con);
}
$this->resetModified();
}
if ($this->collQuestions !== null) {
foreach ($this->collQuestions as $referrerFK) {
if (!$referrerFK->isDeleted()) {
$affectedRows += $referrerFK->save($con);
}
}
}
if ($this->collAnswers !== null) {
foreach ($this->collAnswers as $referrerFK) {
if (!$referrerFK->isDeleted()) {
$affectedRows += $referrerFK->save($con);
}
}
}
if ($this->collInterests !== null) {
foreach ($this->collInterests as $referrerFK) {
if (!$referrerFK->isDeleted()) {
$affectedRows += $referrerFK->save($con);
}
}
}
if ($this->collRelevancys !== null) {
foreach ($this->collRelevancys as $referrerFK) {
if (!$referrerFK->isDeleted()) {
$affectedRows += $referrerFK->save($con);
}
}
}
$this->alreadyInSave = false;
}
return $affectedRows;
}
示例9: doSave
/**
* 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[] = UserPeer::ID;
}
// If this object has been modified, then save it to the database.
if ($this->isModified()) {
if ($this->isNew()) {
$pk = UserPeer::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 += UserPeer::doUpdate($this, $con);
}
$this->resetModified();
// [HL] After being saved an object is no longer 'modified'
}
if ($this->collProjectsRelatedByLeadId !== null) {
foreach ($this->collProjectsRelatedByLeadId as $referrerFK) {
if (!$referrerFK->isDeleted()) {
$affectedRows += $referrerFK->save($con);
}
}
}
if ($this->collProjectsRelatedByUserId !== null) {
foreach ($this->collProjectsRelatedByUserId 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->collOverrideTasks !== null) {
foreach ($this->collOverrideTasks as $referrerFK) {
if (!$referrerFK->isDeleted()) {
$affectedRows += $referrerFK->save($con);
}
}
}
if ($this->collLinks !== null) {
foreach ($this->collLinks as $referrerFK) {
if (!$referrerFK->isDeleted()) {
$affectedRows += $referrerFK->save($con);
}
}
}
$this->alreadyInSave = false;
}
return $affectedRows;
}
示例10: doSave
/**
* 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[] = UserPeer::ID;
}
// If this object has been modified, then save it to the database.
if ($this->isModified()) {
if ($this->isNew()) {
$pk = UserPeer::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 += UserPeer::doUpdate($this, $con);
}
$this->resetModified();
// [HL] After being saved an object is no longer 'modified'
}
if ($this->collExperts !== null) {
foreach ($this->collExperts as $referrerFK) {
if (!$referrerFK->isDeleted()) {
$affectedRows += $referrerFK->save($con);
}
}
}
if ($this->collExpertCategorys !== null) {
foreach ($this->collExpertCategorys as $referrerFK) {
if (!$referrerFK->isDeleted()) {
$affectedRows += $referrerFK->save($con);
}
}
}
if ($this->collHistorys !== null) {
foreach ($this->collHistorys as $referrerFK) {
if (!$referrerFK->isDeleted()) {
$affectedRows += $referrerFK->save($con);
}
}
}
if ($this->collItemRatings !== null) {
foreach ($this->collItemRatings as $referrerFK) {
if (!$referrerFK->isDeleted()) {
$affectedRows += $referrerFK->save($con);
}
}
}
if ($this->collOfferVoucher1s !== null) {
foreach ($this->collOfferVoucher1s as $referrerFK) {
if (!$referrerFK->isDeleted()) {
$affectedRows += $referrerFK->save($con);
}
}
}
if ($this->collPurchaseDetails !== null) {
foreach ($this->collPurchaseDetails as $referrerFK) {
if (!$referrerFK->isDeleted()) {
$affectedRows += $referrerFK->save($con);
}
}
}
if ($this->collShoppingCarts !== null) {
foreach ($this->collShoppingCarts as $referrerFK) {
if (!$referrerFK->isDeleted()) {
$affectedRows += $referrerFK->save($con);
}
}
}
if ($this->collShoutsRelatedByPosterId !== null) {
foreach ($this->collShoutsRelatedByPosterId as $referrerFK) {
if (!$referrerFK->isDeleted()) {
$affectedRows += $referrerFK->save($con);
}
}
}
if ($this->collShoutsRelatedByRecipientId !== null) {
foreach ($this->collShoutsRelatedByRecipientId as $referrerFK) {
if (!$referrerFK->isDeleted()) {
$affectedRows += $referrerFK->save($con);
}
}
}
//.........这里部分代码省略.........
示例11: doSave
/**
* Stores the object 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 Connection $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($con)
{
$affectedRows = 0;
// initialize var to track total num of affected rows
if (!$this->alreadyInSave) {
$this->alreadyInSave = true;
// If this object has been modified, then save it to the database.
if ($this->isModified()) {
if ($this->isNew()) {
$pk = UserPeer::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 += UserPeer::doUpdate($this, $con);
}
$this->resetModified();
// [HL] After being saved an object is no longer 'modified'
}
if ($this->collProfilesRelatedByCreatedBy !== null) {
foreach ($this->collProfilesRelatedByCreatedBy as $referrerFK) {
if (!$referrerFK->isDeleted()) {
$affectedRows += $referrerFK->save($con);
}
}
}
if ($this->collProfilesRelatedByUpdatedBy !== null) {
foreach ($this->collProfilesRelatedByUpdatedBy as $referrerFK) {
if (!$referrerFK->isDeleted()) {
$affectedRows += $referrerFK->save($con);
}
}
}
if ($this->collProfilesRelatedByDeletedBy !== null) {
foreach ($this->collProfilesRelatedByDeletedBy as $referrerFK) {
if (!$referrerFK->isDeleted()) {
$affectedRows += $referrerFK->save($con);
}
}
}
if ($this->collProfilesRelatedByChildUpdatedBy !== null) {
foreach ($this->collProfilesRelatedByChildUpdatedBy as $referrerFK) {
if (!$referrerFK->isDeleted()) {
$affectedRows += $referrerFK->save($con);
}
}
}
if ($this->collProfilePropertysRelatedByCreatedBy !== null) {
foreach ($this->collProfilePropertysRelatedByCreatedBy as $referrerFK) {
if (!$referrerFK->isDeleted()) {
$affectedRows += $referrerFK->save($con);
}
}
}
if ($this->collProfilePropertysRelatedByUpdatedBy !== null) {
foreach ($this->collProfilePropertysRelatedByUpdatedBy as $referrerFK) {
if (!$referrerFK->isDeleted()) {
$affectedRows += $referrerFK->save($con);
}
}
}
if ($this->collProfilePropertysRelatedByDeletedBy !== null) {
foreach ($this->collProfilePropertysRelatedByDeletedBy as $referrerFK) {
if (!$referrerFK->isDeleted()) {
$affectedRows += $referrerFK->save($con);
}
}
}
if ($this->collAgentHasUsers !== null) {
foreach ($this->collAgentHasUsers as $referrerFK) {
if (!$referrerFK->isDeleted()) {
$affectedRows += $referrerFK->save($con);
}
}
}
if ($this->collCollectionsRelatedByCreatedUserId !== null) {
foreach ($this->collCollectionsRelatedByCreatedUserId as $referrerFK) {
if (!$referrerFK->isDeleted()) {
$affectedRows += $referrerFK->save($con);
}
}
}
if ($this->collCollectionsRelatedByUpdatedUserId !== null) {
foreach ($this->collCollectionsRelatedByUpdatedUserId as $referrerFK) {
if (!$referrerFK->isDeleted()) {
//.........这里部分代码省略.........
示例12: doSave
protected function doSave($con)
{
$affectedRows = 0;
if (!$this->alreadyInSave) {
$this->alreadyInSave = true;
if ($this->aUserGroup !== null) {
if ($this->aUserGroup->isModified()) {
$affectedRows += $this->aUserGroup->save($con);
}
$this->setUserGroup($this->aUserGroup);
}
if ($this->aDepartment !== null) {
if ($this->aDepartment->isModified()) {
$affectedRows += $this->aDepartment->save($con);
}
$this->setDepartment($this->aDepartment);
}
if ($this->isModified()) {
if ($this->isNew()) {
$pk = UserPeer::doInsert($this, $con);
$affectedRows += 1;
$this->setId($pk);
$this->setNew(false);
} else {
$affectedRows += UserPeer::doUpdate($this, $con);
}
$this->resetModified();
}
$this->alreadyInSave = false;
}
return $affectedRows;
}
示例13: doSave
protected function doSave($con)
{
$affectedRows = 0;
if (!$this->alreadyInSave) {
$this->alreadyInSave = true;
if ($this->aBranch !== null) {
if ($this->aBranch->isModified()) {
$affectedRows += $this->aBranch->save($con);
}
$this->setBranch($this->aBranch);
}
if ($this->aDegree !== null) {
if ($this->aDegree->isModified()) {
$affectedRows += $this->aDegree->save($con);
}
$this->setDegree($this->aDegree);
}
if ($this->isModified()) {
if ($this->isNew()) {
$pk = UserPeer::doInsert($this, $con);
$affectedRows += 1;
$this->setId($pk);
$this->setNew(false);
} else {
$affectedRows += UserPeer::doUpdate($this, $con);
}
$this->resetModified();
}
if ($this->collUserroles !== null) {
foreach ($this->collUserroles as $referrerFK) {
if (!$referrerFK->isDeleted()) {
$affectedRows += $referrerFK->save($con);
}
}
}
if ($this->collPersonals !== null) {
foreach ($this->collPersonals as $referrerFK) {
if (!$referrerFK->isDeleted()) {
$affectedRows += $referrerFK->save($con);
}
}
}
if ($this->collAddresss !== null) {
foreach ($this->collAddresss as $referrerFK) {
if (!$referrerFK->isDeleted()) {
$affectedRows += $referrerFK->save($con);
}
}
}
if ($this->collProfessionals !== null) {
foreach ($this->collProfessionals as $referrerFK) {
if (!$referrerFK->isDeleted()) {
$affectedRows += $referrerFK->save($con);
}
}
}
if ($this->collFamilys !== null) {
foreach ($this->collFamilys as $referrerFK) {
if (!$referrerFK->isDeleted()) {
$affectedRows += $referrerFK->save($con);
}
}
}
if ($this->collAcademics !== null) {
foreach ($this->collAcademics as $referrerFK) {
if (!$referrerFK->isDeleted()) {
$affectedRows += $referrerFK->save($con);
}
}
}
if ($this->collUserchapterregions !== null) {
foreach ($this->collUserchapterregions as $referrerFK) {
if (!$referrerFK->isDeleted()) {
$affectedRows += $referrerFK->save($con);
}
}
}
if ($this->collUserbadges !== null) {
foreach ($this->collUserbadges as $referrerFK) {
if (!$referrerFK->isDeleted()) {
$affectedRows += $referrerFK->save($con);
}
}
}
if ($this->collLorvaluess !== null) {
foreach ($this->collLorvaluess as $referrerFK) {
if (!$referrerFK->isDeleted()) {
$affectedRows += $referrerFK->save($con);
}
}
}
if ($this->collLorusers !== null) {
foreach ($this->collLorusers as $referrerFK) {
if (!$referrerFK->isDeleted()) {
$affectedRows += $referrerFK->save($con);
}
}
}
if ($this->collMags !== null) {
foreach ($this->collMags as $referrerFK) {
//.........这里部分代码省略.........
示例14: doSave
/**
* Stores the object 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 Connection $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($con)
{
$affectedRows = 0;
// initialize var to track total num of affected rows
if (!$this->alreadyInSave) {
$this->alreadyInSave = true;
// If this object has been modified, then save it to the database.
if ($this->isModified()) {
if ($this->isNew()) {
$pk = UserPeer::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->setUserId($pk);
//[IMV] update autoincrement primary key
$this->setNew(false);
} else {
$affectedRows += UserPeer::doUpdate($this, $con);
}
$this->resetModified();
// [HL] After being saved an object is no longer 'modified'
}
if ($this->collRooms !== null) {
foreach ($this->collRooms as $referrerFK) {
if (!$referrerFK->isDeleted()) {
$affectedRows += $referrerFK->save($con);
}
}
}
if ($this->collMessages !== null) {
foreach ($this->collMessages as $referrerFK) {
if (!$referrerFK->isDeleted()) {
$affectedRows += $referrerFK->save($con);
}
}
}
if ($this->collHistorys !== null) {
foreach ($this->collHistorys as $referrerFK) {
if (!$referrerFK->isDeleted()) {
$affectedRows += $referrerFK->save($con);
}
}
}
if ($this->collProductionHistorys !== null) {
foreach ($this->collProductionHistorys as $referrerFK) {
if (!$referrerFK->isDeleted()) {
$affectedRows += $referrerFK->save($con);
}
}
}
if ($this->collOnlines !== null) {
foreach ($this->collOnlines as $referrerFK) {
if (!$referrerFK->isDeleted()) {
$affectedRows += $referrerFK->save($con);
}
}
}
if ($this->collPermissions !== null) {
foreach ($this->collPermissions as $referrerFK) {
if (!$referrerFK->isDeleted()) {
$affectedRows += $referrerFK->save($con);
}
}
}
$this->alreadyInSave = false;
}
return $affectedRows;
}