示例#1
0
 public function register()
 {
     if (!$this->validate()) {
         return false;
     }
     $user = new User(['username' => $this->username, 'password' => $this->password]);
     $profile = $user->create(Profile::className(), ['nickname' => $this->username, 'display_name' => $this->username]);
     $email = $user->create(Email::className(), ['email' => $this->email]);
     return $user->register([$profile, $email]);
 }
示例#2
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getProfile()
 {
     $profile = Profile::buildNoInitModel();
     return $this->hasOne(Profile::className(), [$profile->createdByAttribute => $this->guidAttribute])->inverseOf('user');
 }