yiisoft / yii2

Yii 2: The Fast, Secure and Professional PHP Framework
http://www.yiiframework.com
BSD 3-Clause "New" or "Revised" License
14.24k stars 6.91k forks source link

View not found with root finder `//` if app has a theme #17458

Closed ahmadasjad closed 5 years ago

ahmadasjad commented 5 years ago

What steps will reproduce the problem?

1: Add theme config

        'view' => [
            'theme' => [
                'basePath' => '@app/themes/abc',
                'baseUrl' => '@web/themes/abc',
                'pathMap' => [
                    '@app/views' => '@app/themes/abc',
                ],
            ],
        ],

2: Call inside any module module: report controller: student action: xyz $this->render('//base-view/xyz', ['var_name' => 'some_value']);

3: File should be like below: theme-dir/abc/base-view/xyz.php

What is the expected result?

The view should be found from the following path: app-dir/theme-dir/abc/views/base-view/xyz.php

What do you get instead?

**View not Found – yii\base\ViewNotFoundException** The view file does not exist: app-dir/modules/report/views/student/base-view/xyz.php

Additional info

Q A
Yii version 2.0.23
PHP version 7.1
Operating system Linux - ubuntu
ahmadasjad commented 5 years ago

When tried to give an example with fresh yii2 repo, it worked. It seems to some config issue with my project.