Close #21 fix bug on search for wrong field
This commit is contained in:
@ -25,10 +25,10 @@ class ProfileController extends Controller
|
|||||||
/**
|
/**
|
||||||
* ProfileController constructor.
|
* ProfileController constructor.
|
||||||
*
|
*
|
||||||
* @param string $id
|
* @param string $id
|
||||||
* @param Module $module
|
* @param Module $module
|
||||||
* @param ProfileQuery $profileQuery
|
* @param ProfileQuery $profileQuery
|
||||||
* @param array $config
|
* @param array $config
|
||||||
*/
|
*/
|
||||||
public function __construct($id, Module $module, ProfileQuery $profileQuery, array $config = [])
|
public function __construct($id, Module $module, ProfileQuery $profileQuery, array $config = [])
|
||||||
{
|
{
|
||||||
@ -67,7 +67,7 @@ class ProfileController extends Controller
|
|||||||
|
|
||||||
public function actionShow($id)
|
public function actionShow($id)
|
||||||
{
|
{
|
||||||
$profile = $this->profileQuery->whereId($id)->one();
|
$profile = $this->profileQuery->whereUserId($id)->one();
|
||||||
|
|
||||||
if ($profile === null) {
|
if ($profile === null) {
|
||||||
throw new NotFoundHttpException();
|
throw new NotFoundHttpException();
|
||||||
|
|||||||
@ -15,13 +15,9 @@ use yii\db\ActiveQuery;
|
|||||||
|
|
||||||
class ProfileQuery extends ActiveQuery
|
class ProfileQuery extends ActiveQuery
|
||||||
{
|
{
|
||||||
public function whereId($id)
|
|
||||||
{
|
|
||||||
return $this->andWhere(['id' => $id]);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Search by user id
|
* Search by user id
|
||||||
|
* @param mixed $user_id
|
||||||
* @return ActiveQuery
|
* @return ActiveQuery
|
||||||
*/
|
*/
|
||||||
public function whereUserId($user_id)
|
public function whereUserId($user_id)
|
||||||
|
|||||||
Reference in New Issue
Block a user