Ejemplo n.º 1
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getProfiles()
 {
     return $this->hasMany(Profile::className(), ['title_id' => 'id']);
 }
Ejemplo n.º 2
0
 public function loadAttributes(User $user)
 {
     // here is the magic happens
     $user->setAttributes(['email' => $this->email, 'username' => $this->username, 'password' => $this->password]);
     /** @var Profile $profile */
     $profile = \Yii::createObject(Profile::className());
     $profile->setAttributes(['title_id' => $this->title_id, 'firstname' => $this->firstname, 'lastname' => $this->lastname, 'idcard' => $this->idcard, 'phone' => $this->phone]);
     $user->setProfile($profile);
 }