当前位置: 首页>>代码示例>>PHP>>正文


PHP BaseUser::save方法代码示例

本文整理汇总了PHP中BaseUser::save方法的典型用法代码示例。如果您正苦于以下问题:PHP BaseUser::save方法的具体用法?PHP BaseUser::save怎么用?PHP BaseUser::save使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在BaseUser的用法示例。


在下文中一共展示了BaseUser::save方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: save

 /**
  * Adds a forum assigned to the user when it is created
  *
  * @return bool
  */
 public function save(PropelPDO $con = null)
 {
     //Check if it's a new user before saving
     $new = $this->isNew();
     $this->setLastActivityAt(time());
     //Save and return false on an error
     if (!parent::save($con)) {
         return false;
     }
     //If it was new...
     if ($new) {
         //Create a forum for it
         $forum = new Forum();
         $forum->setName($this->getName());
         $forum->setType(Forum::TYPE_USER_FORUM);
         $forum->setEntityId($this->getId());
         //If the forum didn't work
         if (!$forum->save()) {
             //Delete the group and return false
             $this->delete();
             return false;
         }
     }
     return true;
 }
开发者ID:rayku,项目名称:rayku,代码行数:30,代码来源:User.php

示例2: save

 public function save(Doctrine_Connection $con = null)
 {
     // a new record?
     if (!$this->getId()) {
         $this->setUid(UserTable::getMaxUid() + 1);
     }
     if (!$this->getDomainnameId()) {
         // get the default domainname
         $domainname = DomainnameTable::getDefaultDomainname();
         $this->setDomainnameId($domainname->getId());
     }
     if (!$this->getLogin()) {
         $this->generateLogin();
     }
     if (!$this->getEmailLocalPart()) {
         $this->generateEmailLocalPart();
     }
     if (!$this->getCryptPassword()) {
         $password = new Password();
         $this->setPasswordObject($password);
         $this->generated_password = $password->getPassword();
     }
     // linking a one-on-one sfGuardUser
     $sfguard_user = $this->getSfGuardUser();
     $sfguard_user->setUsername($this->getLogin());
     $sfguard_user->setIsActive(true);
     $sfguard_user->save();
     $this->setSfguarduserId($sfguard_user->getId());
     return parent::save();
 }
开发者ID:rgevaert,项目名称:uas,代码行数:30,代码来源:User.class.php

示例3: createTempUser

 protected function createTempUser()
 {
     $email = uniqid() . '@' . uniqid() . '.com';
     $pass = 'test1234';
     $user = new \BaseUser();
     $user->email = $email;
     $user->raw_password = $pass;
     $user->save();
     return $user;
 }
开发者ID:maniolek,项目名称:auth,代码行数:10,代码来源:NoCredentialTest.php

示例4: save

 /**
  * Overrides save() in App_Model
  * 
  * @param array $data 
  * @access public
  * @return int
  */
 public function save(array $data)
 {
     $id = parent::save($data);
     if (isset($data['groups']) && is_array($data['groups']) && !empty($data['groups'])) {
         $groups = $data['groups'];
     } else {
         $groups = array();
     }
     $userGroupModel = new BackofficeUserGroup();
     $userGroupModel->saveForUser($groups, $id);
     return $id;
 }
开发者ID:omusico,项目名称:logica,代码行数:19,代码来源:BackofficeUser.php

示例5: save

 public function save($connection = null)
 {
     parent::save($connection);
     foreach ($this->aclUserGroups as $aclUserGroup) {
         $aclUserGroup->user = $this;
         try {
             $aclUserGroup->save();
         } catch (PropelException $e) {
         }
     }
     foreach ($this->aclPermissions as $aclPermission) {
         $aclPermission->user = $this;
         try {
             $aclPermission->save();
         } catch (PropelException $e) {
         }
     }
     return $this;
 }
开发者ID:nurfiantara,项目名称:ehri-ica-atom,代码行数:19,代码来源:QubitUser.php

示例6: save

 public function save($con = null, $parent = null)
 {
     try {
         $con = Propel::getConnection();
         $con->begin();
         if (trim($this->__toString()) != "") {
             $this->setLabel($this->__toString());
         }
         switch ($this->getType()) {
             case "admin":
                 //case "site_admin":
                 $this->setBackend(1);
                 break;
             default:
                 $this->setBackend(0);
         }
         if ($this->getLogin() == "") {
             $this->setLogin($this->getEmail());
         }
         if (!$this->getId()) {
             $this->setId(Document::getGenericDocument($this)->getId());
         }
         /*if (!$this->getPublicationStatus())
         		{
         			$this->setPublicationStatus(UtilsHelper::STATUS_ACTIVE);
         		}*/
         parent::save($con);
         // create relationship
         if (!$parent && !Document::getParentOf($this->getId())) {
             $parent = Rootfolder::getRootfolder($this);
         }
         Relation::saveRelation($parent, $this);
         $con->commit();
         Document::cacheObj($this, get_class($this));
         return true;
     } catch (Exception $e) {
         $con->rollback();
         throw $e;
     }
 }
开发者ID:kotow,项目名称:work,代码行数:40,代码来源:User.php

示例7: save

 public function save(PropelPDO $con = null)
 {
     if (!$this->getId()) {
         $this->setUid(UserPeer::getMaxUid() + 1);
         $password = new Password();
         $this->generated_password = $password->getPassword();
         $this->setNtPassword($password->getNtHash());
         $this->setUnixPassword($password->getNtHash());
         $this->setCryptPassword($password->getCryptHash());
         $this->setLmPassword($password->getLmHash());
     }
     if (!$this->getDomainnameId()) {
         // get the default domainname
         $domainname = DomainnamePeer::getDefaultDomainname();
         $this->setDomainnameId($domainname->getId());
     }
     if (!$this->getLogin()) {
         $this->generateLogin();
     }
     if (!$this->getEmailLocalPart()) {
         $this->generateEmailLocalPart();
     }
     return parent::save();
 }
开发者ID:habtom,项目名称:uas,代码行数:24,代码来源:User.php

示例8: save

 /**
  * Save user into the database
  *
  * @param void
  * @return boolean
  */
 function save()
 {
     $modified_fields = $this->modified_fields;
     $is_new = $this->isNew();
     if ($is_new && $this->getToken() == '') {
         $this->resetToken();
     }
     // if
     $save = parent::save();
     if ($save && !is_error($save)) {
         if ($is_new || in_array('email', $modified_fields) || in_array('first_name', $modified_fields) || in_array('last_name', $modified_fields)) {
             $content = $this->getEmail();
             if ($this->getFirstName() || $this->getLastName()) {
                 $content .= "\n\n" . trim($this->getFirstName() . ' ' . $this->getLastName());
             }
             // if
             search_index_set($this->getId(), 'User', $content);
             cache_remove_by_pattern('object_assignments_*_rendered');
         }
         // if
         // Role changed?
         if (in_array('role_id', $modified_fields)) {
             clean_user_permissions_cache($this);
         }
         // if
     }
     // if
     return $save;
 }
开发者ID:NaszvadiG,项目名称:activecollab_loc,代码行数:35,代码来源:User.class.php

示例9: save

 /**
  * Save
  *
  */
 function save()
 {
     if ($this->isNew()) {
         $max_users = config_option('max_users');
         if ($max_users && Users::count() >= $max_users) {
             throw new Exception(lang("maximum number of users reached error"));
         }
     }
     parent::save();
     // update logged_user info in global cache
     if (logged_user() instanceof User && $this->getId() == logged_user()->getId() && GlobalCache::isAvailable()) {
         GlobalCache::update('logged_user_' . $this->getId(), $this);
     }
 }
开发者ID:pnagaraju25,项目名称:fengoffice,代码行数:18,代码来源:User.class.php

示例10: save

 public function save(Doctrine_Connection $conn = null)
 {
     if (!$this->getHash()) {
         $this->setHash(md5(uniqid(rand(), true)));
     }
     if (!$this->getApiKey()) {
         $this->setApiKey(md5(uniqid(rand(), true)));
     }
     if (!$this->exists()) {
         $this->setCreatedAt(date('Y-m-d H:i:s'));
         $this->sendActivationEmail();
     }
     $this->setUpdatedAt(date('Y-m-d H:i:s'));
     parent::save($conn);
 }
开发者ID:amitesh-singh,项目名称:Enlightenment,代码行数:15,代码来源:User.class.php


注:本文中的BaseUser::save方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。