You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
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.
The text was updated successfully, but these errors were encountered: