Close #21 fix bug on search for wrong field

This commit is contained in:
Antonio Ramirez
2017-07-15 16:44:33 +02:00
parent 2dbc7f5508
commit 8c4f7699df
2 changed files with 5 additions and 9 deletions

View File

@ -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();

View File

@ -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)