/** * @return \yii\db\ActiveQuery */ public function getProfiles() { return $this->hasMany(Profile::className(), ['title_id' => 'id']); }
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); }