本文整理汇总了PHP中sfGuardUser::isNew方法的典型用法代码示例。如果您正苦于以下问题:PHP sfGuardUser::isNew方法的具体用法?PHP sfGuardUser::isNew怎么用?PHP sfGuardUser::isNew使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sfGuardUser
的用法示例。
在下文中一共展示了sfGuardUser::isNew方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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->asfGuardUser !== null) {
if ($this->asfGuardUser->isModified() || $this->asfGuardUser->isNew()) {
$affectedRows += $this->asfGuardUser->save($con);
}
$this->setsfGuardUser($this->asfGuardUser);
}
if ($this->isNew() || $this->isModified()) {
// persist changes
if ($this->isNew()) {
$this->doInsert($con);
} else {
$this->doUpdate($con);
}
$affectedRows += 1;
$this->resetModified();
}
$this->alreadyInSave = false;
}
return $affectedRows;
}
示例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;
// 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->asfGuardUser !== null) {
if ($this->asfGuardUser->isModified() || $this->asfGuardUser->isNew()) {
$affectedRows += $this->asfGuardUser->save($con);
}
$this->setsfGuardUser($this->asfGuardUser);
}
// If this object has been modified, then save it to the database.
if ($this->isModified()) {
if ($this->isNew()) {
$pk = sfGuardRememberKeyPeer::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 += sfGuardRememberKeyPeer::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->asfGuardUser !== null) {
if ($this->asfGuardUser->isModified() || $this->asfGuardUser->isNew()) {
$affectedRows += $this->asfGuardUser->save($con);
}
$this->setsfGuardUser($this->asfGuardUser);
}
// If this object has been modified, then save it to the database.
if ($this->isModified()) {
if ($this->isNew()) {
$criteria = $this->buildCriteria();
$pk = BasePeer::doInsert($criteria, $con);
$affectedRows += 1;
$this->setNew(false);
} else {
$affectedRows += sfGuardRememberKeyPeer::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->asfGuardUser !== null) {
if ($this->asfGuardUser->isModified() || $this->asfGuardUser->isNew()) {
$affectedRows += $this->asfGuardUser->save($con);
}
$this->setsfGuardUser($this->asfGuardUser);
}
if ($this->aPartidoRelatedByPartidoVideo1Id !== null) {
if ($this->aPartidoRelatedByPartidoVideo1Id->isModified() || $this->aPartidoRelatedByPartidoVideo1Id->isNew()) {
$affectedRows += $this->aPartidoRelatedByPartidoVideo1Id->save($con);
}
$this->setPartidoRelatedByPartidoVideo1Id($this->aPartidoRelatedByPartidoVideo1Id);
}
if ($this->aPartidoRelatedByPartidoVideo2Id !== null) {
if ($this->aPartidoRelatedByPartidoVideo2Id->isModified() || $this->aPartidoRelatedByPartidoVideo2Id->isNew()) {
$affectedRows += $this->aPartidoRelatedByPartidoVideo2Id->save($con);
}
$this->setPartidoRelatedByPartidoVideo2Id($this->aPartidoRelatedByPartidoVideo2Id);
}
if ($this->isNew()) {
$this->modifiedColumns[] = PropuestaPeer::ID;
}
// If this object has been modified, then save it to the database.
if ($this->isModified()) {
if ($this->isNew()) {
$pk = PropuestaPeer::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 += PropuestaPeer::doUpdate($this, $con);
}
$this->resetModified();
// [HL] After being saved an object is no longer 'modified'
}
if ($this->collEnlaces !== null) {
foreach ($this->collEnlaces 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);
}
}
}
$this->alreadyInSave = false;
}
return $affectedRows;
}
示例5: executeEdit
public function executeEdit(sfWebRequest $request)
{
$id = $request->getParameter('id');
if (is_numeric($id)) {
$user = sfGuardUserTable::getInstance()->find($id);
/* @var $user sfGuardUser */
if (!$user) {
return $this->notFound();
}
} else {
$user = new sfGuardUser();
$user->setIsActive(false);
}
if (!$this->getGuardUser()->getIsSuperAdmin() && $user->getIsSuperAdmin()) {
$this->noAccess();
}
if ($user->isNew()) {
$this->form = new UserNewForm($user);
} else {
$this->form = new UserForm($user);
}
if ($request->isMethod('post')) {
$this->form->bind($request->getPostParameter($this->form->getName()));
if ($this->form->isValid()) {
$con = sfGuardUserTable::getInstance()->getConnection();
$con->beginTransaction();
try {
$this->form->updateGroupsList($this->form->getValues());
$user = $this->form->updateObject();
$user->setUsername($user->getEmailAddress());
if ($user->isNew()) {
$user->setValidationKind(sfGuardUserTable::VALIDATION_KIND_BACKEND_LINK);
$user->randomValidationCode();
$user->save();
$subject = 'validate activation';
$body = "#VALIDATION-URL#";
$store = StoreTable::getInstance()->findByKeyAndLanguageWithFallback(StoreTable::NEW_USER_ADMIN_MAIL, $user->getLanguageId());
if ($store) {
$subject = $store->getField('subject');
$body = $store->getField('body');
}
$subst = array('#VALIDATION-URL#' => $this->generateUrl('user_validation', array('id' => $user->getId(), 'code' => $user->getValidationCode()), true), '#USER-NAME#' => $user->getFullName());
UtilMail::send(null, null, $user->getEmailAddress(), $subject, $body, null, $subst);
} else {
$user->save();
}
$con->commit();
} catch (Exception $e) {
$con->rollback();
throw $e;
}
return $this->ajax()->redirectRotue('user_idx')->render();
} else {
return $this->ajax()->form($this->form)->render();
}
}
if (!$user->isNew()) {
$this->campaign_rights_list = CampaignRightsTable::getInstance()->queryByUser($user)->execute();
$this->petition_rights_list = PetitionRightsTable::getInstance()->queryByUser($user)->execute();
}
}
示例6: 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->aRepository !== null) {
if ($this->aRepository->isModified() || $this->aRepository->isNew()) {
$affectedRows += $this->aRepository->save($con);
}
$this->setRepository($this->aRepository);
}
if ($this->asfGuardUser !== null) {
if ($this->asfGuardUser->isModified() || $this->asfGuardUser->isNew()) {
$affectedRows += $this->asfGuardUser->save($con);
}
$this->setsfGuardUser($this->asfGuardUser);
}
if ($this->isNew() || $this->isModified()) {
// persist changes
if ($this->isNew()) {
$this->doInsert($con);
} else {
$this->doUpdate($con);
}
$affectedRows += 1;
$this->resetModified();
}
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()) {
$affectedRows += $referrerFK->save($con);
}
}
}
if ($this->filesScheduledForDeletion !== null) {
if (!$this->filesScheduledForDeletion->isEmpty()) {
FileQuery::create()->filterByPrimaryKeys($this->filesScheduledForDeletion->getPrimaryKeys(false))->delete($con);
$this->filesScheduledForDeletion = null;
}
}
if ($this->collFiles !== null) {
foreach ($this->collFiles as $referrerFK) {
if (!$referrerFK->isDeleted()) {
$affectedRows += $referrerFK->save($con);
}
}
}
if ($this->statusActionsScheduledForDeletion !== null) {
if (!$this->statusActionsScheduledForDeletion->isEmpty()) {
StatusActionQuery::create()->filterByPrimaryKeys($this->statusActionsScheduledForDeletion->getPrimaryKeys(false))->delete($con);
$this->statusActionsScheduledForDeletion = null;
}
}
if ($this->collStatusActions !== null) {
foreach ($this->collStatusActions as $referrerFK) {
if (!$referrerFK->isDeleted()) {
$affectedRows += $referrerFK->save($con);
}
}
}
$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;
// 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->aContact !== null) {
if ($this->aContact->isModified() || $this->aContact->isNew()) {
$affectedRows += $this->aContact->save($con);
}
$this->setContact($this->aContact);
}
if ($this->asfGuardUser !== null) {
if ($this->asfGuardUser->isModified() || $this->asfGuardUser->isNew()) {
$affectedRows += $this->asfGuardUser->save($con);
}
$this->setsfGuardUser($this->asfGuardUser);
}
if ($this->isNew() || $this->isModified()) {
// persist changes
if ($this->isNew()) {
$this->doInsert($con);
} else {
$this->doUpdate($con);
}
$affectedRows += 1;
$this->resetModified();
}
if ($this->sessionsScheduledForDeletion !== null) {
if (!$this->sessionsScheduledForDeletion->isEmpty()) {
foreach ($this->sessionsScheduledForDeletion as $session) {
// need to save related object because we set the relation to null
$session->save($con);
}
$this->sessionsScheduledForDeletion = null;
}
}
if ($this->collSessions !== null) {
foreach ($this->collSessions as $referrerFK) {
if (!$referrerFK->isDeleted()) {
$affectedRows += $referrerFK->save($con);
}
}
}
if ($this->singleSignOnKeysScheduledForDeletion !== null) {
if (!$this->singleSignOnKeysScheduledForDeletion->isEmpty()) {
SingleSignOnKeyQuery::create()->filterByPrimaryKeys($this->singleSignOnKeysScheduledForDeletion->getPrimaryKeys(false))->delete($con);
$this->singleSignOnKeysScheduledForDeletion = null;
}
}
if ($this->collSingleSignOnKeys !== null) {
foreach ($this->collSingleSignOnKeys as $referrerFK) {
if (!$referrerFK->isDeleted()) {
$affectedRows += $referrerFK->save($con);
}
}
}
if ($this->systemEventSubscriptionsScheduledForDeletion !== null) {
if (!$this->systemEventSubscriptionsScheduledForDeletion->isEmpty()) {
SystemEventSubscriptionQuery::create()->filterByPrimaryKeys($this->systemEventSubscriptionsScheduledForDeletion->getPrimaryKeys(false))->delete($con);
$this->systemEventSubscriptionsScheduledForDeletion = null;
}
}
if ($this->collSystemEventSubscriptions !== null) {
foreach ($this->collSystemEventSubscriptions as $referrerFK) {
if (!$referrerFK->isDeleted()) {
$affectedRows += $referrerFK->save($con);
}
}
}
if ($this->systemEventInstancesScheduledForDeletion !== null) {
if (!$this->systemEventInstancesScheduledForDeletion->isEmpty()) {
foreach ($this->systemEventInstancesScheduledForDeletion as $systemEventInstance) {
// need to save related object because we set the relation to null
$systemEventInstance->save($con);
}
$this->systemEventInstancesScheduledForDeletion = null;
}
}
if ($this->collSystemEventInstances !== null) {
foreach ($this->collSystemEventInstances as $referrerFK) {
if (!$referrerFK->isDeleted()) {
$affectedRows += $referrerFK->save($con);
}
}
//.........这里部分代码省略.........