From 8c4f7699df8ef91f8ee7cfd45ce1f1e4670fa576 Mon Sep 17 00:00:00 2001 From: Antonio Ramirez Date: Sat, 15 Jul 2017 16:44:33 +0200 Subject: [PATCH] Close #21 fix bug on search for wrong field --- src/User/Controller/ProfileController.php | 8 ++++---- src/User/Query/ProfileQuery.php | 6 +----- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/src/User/Controller/ProfileController.php b/src/User/Controller/ProfileController.php index df5444b..9852d7c 100644 --- a/src/User/Controller/ProfileController.php +++ b/src/User/Controller/ProfileController.php @@ -25,10 +25,10 @@ class ProfileController extends Controller /** * ProfileController constructor. * - * @param string $id - * @param Module $module + * @param string $id + * @param Module $module * @param ProfileQuery $profileQuery - * @param array $config + * @param array $config */ public function __construct($id, Module $module, ProfileQuery $profileQuery, array $config = []) { @@ -67,7 +67,7 @@ class ProfileController extends Controller public function actionShow($id) { - $profile = $this->profileQuery->whereId($id)->one(); + $profile = $this->profileQuery->whereUserId($id)->one(); if ($profile === null) { throw new NotFoundHttpException(); diff --git a/src/User/Query/ProfileQuery.php b/src/User/Query/ProfileQuery.php index 5eb4bf8..33d9b1c 100644 --- a/src/User/Query/ProfileQuery.php +++ b/src/User/Query/ProfileQuery.php @@ -15,13 +15,9 @@ use yii\db\ActiveQuery; class ProfileQuery extends ActiveQuery { - public function whereId($id) - { - return $this->andWhere(['id' => $id]); - } - /** * Search by user id + * @param mixed $user_id * @return ActiveQuery */ public function whereUserId($user_id)