diff --git a/src/User/Controller/SettingsController.php b/src/User/Controller/SettingsController.php index 832bf37..4ac0025 100644 --- a/src/User/Controller/SettingsController.php +++ b/src/User/Controller/SettingsController.php @@ -104,7 +104,7 @@ class SettingsController extends Controller public function actionProfile() { - $profile = $this->profileQuery->whereId(Yii::$app->user->identity->getId())->one(); + $profile = $this->profileQuery->whereUserId(Yii::$app->user->identity->getId())->one(); if ($profile === null) { $profile = $this->make(Profile::class); diff --git a/src/User/Query/ProfileQuery.php b/src/User/Query/ProfileQuery.php index 33b9155..5eb4bf8 100644 --- a/src/User/Query/ProfileQuery.php +++ b/src/User/Query/ProfileQuery.php @@ -19,4 +19,13 @@ class ProfileQuery extends ActiveQuery { return $this->andWhere(['id' => $id]); } + + /** + * Search by user id + * @return ActiveQuery + */ + public function whereUserId($user_id) + { + return $this->andWhere(['user_id' => $user_id]); + } }