diff --git a/src/User/Model/User.php b/src/User/Model/User.php index 8d68a7f..8605cec 100644 --- a/src/User/Model/User.php +++ b/src/User/Model/User.php @@ -90,6 +90,19 @@ class User extends ActiveRecord implements IdentityInterface return parent::beforeSave($insert); } + /** + * @inheritdoc + */ + public function afterSave($insert, $changedAttributes) + { + parent::afterSave($insert, $changedAttributes); + + if ($insert && $this->profile === null) { + $profile = $this->make(Profile::class); + $profile->link('user', $this); + } + } + /** * {@inheritdoc} */