Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Calling unknown method: frontend\modules\api\v1\controllers\UserController::findModel() #314

Closed
FedericoBenedetti1976 opened this issue Oct 28, 2015 · 0 comments

Comments

@FedericoBenedetti1976
Copy link

Hi, i'm trying yii2-starter-kit restful api .
I try to run this link:
https://mysite/api/v1/user/view?id=3
and i get this json response:
{
"name": "Exception",
"message": "Calling unknown method: frontend\modules\api\v1\controllers\UserController::findModel()",
"code": 0,
"type": "yii\base\UnknownMethodException",
"file": "/var/www/mysite/yii2-starter-kit/vendor/yiisoft/yii2/base/Component.php",
"line": 285,
"stack-trace": [
"#0 [internal function]: yii\base\Component->__call('findModel', Array)",
"#1 [internal function]: frontend\modules\api\v1\controllers\UserController->findModel('3', Object(yii\rest\ViewAction))",
"#2 /var/www/mysite/yii2-starter-kit/vendor/yiisoft/yii2/rest/Action.php(83): call_user_func(Array, '3', Object(yii\rest\ViewAction))",
"#3 /var/www/mysite/yii2-starter-kit/vendor/yiisoft/yii2/rest/ViewAction.php(27): yii\rest\Action->findModel('3')",
"#4 [internal function]: yii\rest\ViewAction->run('3')",
"#5 /var/www/mysite/yii2-starter-kit/vendor/yiisoft/yii2/base/Action.php(92): call_user_func_array(Array, Array)",
"#6 /var/www/mysite/yii2-starter-kit/vendor/yiisoft/yii2/base/Controller.php(151): yii\base\Action->runWithParams(Array)",
"#7 /var/www/mysite/yii2-starter-kit/vendor/yiisoft/yii2/base/Module.php(455): yii\base\Controller->runAction('view', Array)",
"#8 /var/www/mysite/yii2-starter-kit/vendor/yiisoft/yii2/web/Application.php(84): yii\base\Module->runAction('api/v1/user/vie...', Array)",
"#9 /var/www/mysite/yii2-starter-kit/vendor/yiisoft/yii2/base/Application.php(375): yii\web\Application->handleRequest(Object(yii\web\Request))",
"#10 /var/www/mysite/yii2-starter-kit/frontend/web/index.php(22): yii\base\Application->run()",
"#11 {main}"
]
}

If i try to comment this line:
// 'findModel' => [$this, 'findModel']
into UserController.php i get this result:
{
"id": 3,
"username": "user",
"created_at": 1445879706
}

at a first view could be a bug.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants