public function afterSave($insert, $changedAttributes) { if ($insert) { $profile = new Profile(); $profile->user_id = $this->id; $profile->load(Yii::$app->request->post()); if ($profile->save()) { $this->prepareUserDir(); } else { throw new NotSupportedException('Save profile ERROR.'); } parent::afterSave($insert, $changedAttributes); } }