deerawan / yii2-advanced-api

Yii2 advanced template with RESTful API setup
Other
194 stars 157 forks source link

Class not found error for module #14

Closed gvanto closed 7 years ago

gvanto commented 7 years ago

I have an issue with class not being found: http://stackoverflow.com/questions/41096504/yii2-module-not-under-vendor-folder-class-not-found-in-config-main-php

I've downloaded this repository (yii2-advanced-api) and used the api folder ...

gvanto commented 7 years ago

OK got it: in common/config/bootstrap.php, add:

Yii::setAlias('@api', dirname(dirname(DIR)) . '/api'); Then in config/main.php use:

'modules' => [ 'v1' => [ 'basePath' => '@api/modules/v1', 'class' => 'api\modules\v1\Module' ] ],