J
J
Julia Kovalenko2016-04-26 14:32:24
Yii
Julia Kovalenko, 2016-04-26 14:32:24

Error while creating submodule in yii2. How to fix?

I need to create v1 module in api module. Here is the structure:
bf10f849b1a24fd8af2e8283a9ed6abb.png
I generated everything through gii.
In the application config I wrote

'modules' => [
        //...
        'api' => [
            'class' => 'app\modules\api\Module',
        ],
    ],

File ..\modules\api\Module.php:
<?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',
            ],
        ];
    }
}

File ..\modules\api\modules\v1\Module.php :
<?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();
    }
}

Error when opening project.local/api/v1 link in browser:
a2005a6a47a04bbca460fe65c1610ba2.png
How to fix this?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
alex stephen, 2016-04-27
@kovalenko_jul_s

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 question

Ask a Question

731 491 924 answers to any question