Answer the question
In order to leave comments, you need to log in
Error while creating submodule in yii2. How to fix?
I need to create v1 module in api module. Here is the structure:
I generated everything through gii.
In the application config I wrote
'modules' => [
//...
'api' => [
'class' => 'app\modules\api\Module',
],
],
<?php
namespace app\modules\api;
class Module extends \yii\base\Module
{
public $controllerNamespace = 'app\modules\api\controllers';
public function init()
{
parent::init();
$this->modules = [
'v1' => [
'class' => 'app\modules\api\modules\v1\Module',
],
];
}
}
<?php
namespace app\modules\api\modules\v1;
class Module extends \yii\base\Module
{
public $controllerNamespace = 'app\modules\api\modules\v1\controllers';
public function init()
{
parent::init();
}
}
Answer the question
In order to leave comments, you need to log in
Known
error .
In the next release, they should post a fix, but for now, you can fix it yourself in the vendor (see commit )
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question