I've created a module under folder api (which itself is same level as backend & frontend in yii2 advanced app).
Folder structure:
api
-- common
------ controllers
------ models
-- config
-- modules
------ v1
---------- controllers
---------- models
-- runtime
-- tests
-- web
In api/config/main.php:
return [
'id' => 'app-api',
'basePath' => dirname(__DIR__),
'bootstrap' => ['log'],
'modules' => [
'v1' => [
'basePath' => '@app/modules/v1',
'class' => 'api\modules\v1\Module'
]
],
I get error:
ReflectionException
Class api\modules\v1\Module does not exist
The class is definitely there.
I've run a composer dumpautoload (no errors).
urlManager in config/main.php:
'urlManager' => [
'enablePrettyUrl' => true,
'enableStrictParsing' => true,
'showScriptName' => false,
'rules' => [
'v1/site/index' => 'v1/site/index', //module/controller/action
],
]
Any help much appreciated,
thanks
Aucun commentaire:
Enregistrer un commentaire