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


PHP User::setAttributes方法代码示例

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


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

示例1: register

 /**
  * Registers a new user account.
  * @return bool
  */
 public function register()
 {
     if (!$this->validate()) {
         return false;
     }
     $this->user->setAttributes(['email' => $this->email, 'username' => $this->username, 'password' => $this->password]);
     return $this->user->register();
 }
开发者ID:manyoubaby123,项目名称:imshop,代码行数:12,代码来源:RegistrationForm.php

示例2: loadAttributes

 /**
  * @inheritdoc
  */
 protected function loadAttributes(\dektrium\user\models\User $user)
 {
     $user->setAttributes(['email' => $this->email, 'username' => $this->username, 'password' => $this->password]);
     $profile = \Yii::createObject(Profile::className());
     $profile->setAttributes(['name' => ucwords(strtolower($this->firstname)) . " " . ucwords(strtolower($this->lastname)), 'firstname' => ucwords(strtolower($this->firstname)), 'lastname' => ucwords(strtolower($this->lastname)), 'birthday' => $this->birthday, 'terms' => $this->terms]);
     $user->setProfile($profile);
 }
开发者ID:cinghie,项目名称:yii2-user-extended,代码行数:10,代码来源:RegistrationForm.php

示例3: loadAttributes

 public function loadAttributes(User $user)
 {
     $user->setAttributes($this->attributes);
     $profile = \Yii::createObject(Profile::className());
     $profile->setAttributes(['name' => $this->name]);
     $user->setProfile($profile);
 }
开发者ID:Uthpala,项目名称:doingiteasychannel,代码行数:7,代码来源:RegistrationForm.php

示例4: loadAttributes

 /**
  * Loads attributes to the user model. You should override this method if you are going to add new fields to the
  * registration form. You can read more in special guide.
  *
  * By default this method set all attributes of this model to the attributes of User model, so you should properly
  * configure safe attributes of your User model.
  *
  * @param User $user
  */
 protected function loadAttributes(User $user)
 {
     $user->setAttributes($this->attributes);
 }
开发者ID:damasco,项目名称:yii2-user,代码行数:13,代码来源:RegistrationForm.php


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