E
E
Evgenia2019-03-21 17:21:15
Yii
Evgenia, 2019-03-21 17:21:15

Why doesn't routing work in yii2 module?

Good afternoon!
In the advanced application, a module has been created via gii with the following structure:

frontend
    |__ ...
    |__modules
         |__ orderDescription
              |__ controllers
                  |__ DefaultController
              |__ models
                  |__ search
                      |__ GroupSearch
                      |__ ManufacturerSearch
                      |__ OrderItemSearch
                      |__ OrderSearch
                      |__ ProductSearch
                  |__ Group
                  |__ Manufacturer
                  |__Order
                  |__OrderItem
                  |__Product
              |__ views
                  |__ default
                      |__ _form
                      |__ _search
                      |__ about
                      |__ create
                      |__ index
                      |__ update
                      |__ view

The application has two databases connected, one main for the entire site, the second only for the module. Each module model specifies which base to use:
public static function getDb() {
        return Yii::$app->get('db2'); // second database
    }

The orderDescription/index page is loaded, the rest of the views are not, it returns 404, even when going to static pages (for example, to ../orderDescription/default/about). What could be wrong?
UrlManager in frontend/config/main.php:
'urlManager' => [
            'enablePrettyUrl' => true,
            'enableStrictParsing' => true,
            'showScriptName' => false,
            'class' => 'yii\web\UrlManager',
            'rules' => [
                'kbase/<id>' => 'article/view',
                'kbase/tag/<tag>' => 'article/index',
                'kbase' => 'article/index',
                'search' => 'search/index',
                'finder/<action>' => 'vendor-code/<action>',
                'library/read-later' => 'library/read-later',
                'library/reading' => 'library/reading',
                'library/bookshelf' => 'library/bookshelf',
                'library/control' => 'library/control',
                'library/tags' => 'library/tags',
                'library/<id:\d+>' => 'library/view',
                'library' => 'library/index',
                'login' => 'site/login',
                'logout' => 'site/logout',
                'request-password-reset' => 'site/request-password-reset',
                'reset-password' => 'site/reset-password',
                'feedback/create' => 'feedback/create',
                '/' => 'article/index',
                'orderDescription' => 'orderDescription',
            ]
        ]

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question