nvlad / yii2support

Yii2 Support for PhpStorm / IntelliJ IDEA
https://plugins.jetbrains.com/idea/plugin/9388-yii2-support
Other
294 stars 53 forks source link

Your plugin can't find views' files #181

Open mike-kramer opened 6 years ago

mike-kramer commented 6 years ago

In all my working controllers and widgets your plugin show it can't find a view file

Additional info

Q A
IDE Name PhpStorm
IDE Version 2017.3.4
Plugin version 0.8.42.5
Yii App Template basic
nvlad commented 6 years ago

Yii project root is PhpStorm project root?

mike-kramer commented 6 years ago

Yes. And I tried to point Yii root in plugin settings - no result. And I've just updated PhpStorm to 2017.3.6 - the situation is same. Once plugin found my views, but after a couple of hour it doesn't again.
image

mike-kramer commented 6 years ago

I've tried this: image Now plugin finds my views

rusniker commented 6 years ago

Same problem.
image

PhpStorm 2017.3.6 Plugin 0.8.42.5 Yii project root is PhpStorm project root.

Renkas commented 6 years ago

I still have the same problem. This problem appeared about 2 months ago. Before that it worked perfectly.

PhpStorm 2017.3.5 and also in PhpStorm 2018.1

mike-kramer commented 6 years ago

I have this problem only with my old projects. Today I started new Yii2-project, and plugin works with it perfect.

asamats commented 6 years ago

I'm also have this problem. With a new project this is work perfect. I try use PhpStorm 2017.3.x and PhpStorm 2018.1

View file for "create" not found in "/modules/modules/[name]/views/[name]/create.php". less... (Ctrl+1) Reports missing view templates

I don't know why it creates double path 'modules'

andrew-svirin commented 6 years ago

my path to /modules/[module_name]/frontend/views do not recognizing too.

papppeter commented 6 years ago

i found it to.

yujin1st commented 6 years ago

In our team projects i use such structure: /modules/[module]/views/[web_end]/[controller]/view.php if you add support, i'd be grateful.

papppeter commented 6 years ago

see my picture.

if there is a missing view, it creates it. the path is correct. but after creation it does not find it any more.

our modules structure is: /modules/[module]/[web_end]/views/[controller]/view.php

thanks for your help

screenshot_4

a6ka commented 6 years ago

Баг появился с версией 0.8.38 Откатился на 0.7.35.2 - все стало в порядке. Посмотри, что менял между этими версиями. Возможно быстро поймешь причину. Все, что выше 0.8.38 сломано (перепробовал все от 0.9.54.9)

nvlad commented 6 years ago

@a6ka в версии 0.8.* была полностью переделана работа с вьюхами. Как закончу с миграциями, вернусь к вьюхам.

robsch commented 6 years ago

Same here with version 0.10.56.15 and PhpStorm 2018.2.1 (Linux). However, the concering project contains just a Yii module, but with normal controllers, models, views. Can it also be related to the namespace? If I let the view file be created the namespace of the current controller gets used, but my namespace has some additional elements prepended, so the view file does not get created at the correct position. Therefore my guess is the Yii root path setting is not enough - there should be also a namespace setting so that view files gets created into the right directory.

I have another project that was originally an yii2-advanced project and here SOME view files can be found (a pity when 'it works sometimes' ... ;-) ) There is one controller with the correct view file linking option: If I choose 'Go to declaration' I have to choose between the correct one and vendor/codeception/base/tests/data/app/controllers.php. Other controllers show a red line under the view file name, but 'Go to declaration' works anyway and leads again to the test file.

Btw one question: what happens if the Yii root path setting is blank? Will then the regular project root path be used? It seems to me that I don't have to populate this setting. Could you add this to the Readme file, please?

CrazyHenk44 commented 5 years ago

In some projects it works fine and in some it does not work at all. I compared settings for the "Yii2 Support', but found no differences.

What can we do to fix this? Any workarounds?

slo-nik commented 5 years ago

Использую версию 0.10.56.18. Не видит view подключаемых через $this->render() в контролерах, выдаёт ошибку View file for views not found in /modules/modules/production/views/frontend/products/view.php предлагает создать представление. Если создать, то файл создаётся по пути app\modules\modules\production\views\frontend\products Используется темизация или нет - не играет роли. Специально создал проект, настроил темизацию, все представления в контролерах определяет.

stevekr commented 5 years ago

Modules are located at/root/common/modules, but module controllers are giving view not found error. Controller namespace is modules\[module]\controllers and plugin is looking at '/root/common/[module]/views instead of /root/common/modules/[module]/views. Plugin version v0.10.56.22

Mitchell64 commented 5 years ago

I just found this thread and am experiencing the same problem--view files are not recognized within controllers.

View file for "contact" not found in "//views/site/contact.php". Inspection info: Reports missing view templates

PhpStorm 2018.3 Build 183.4284.150 Yii2 Support version 0.10.56.22

blacksmoke26 commented 5 years ago

Same issues with 2019.1 EAP!

dekmabot commented 5 years ago

Same issue, 2019.1. Is there any solution?

Lisio commented 5 years ago

Still not fixed, searches for /modules/modules/{module}/views dir.

papppeter commented 5 years ago

Still no solution, can it be reverted back to simple ../views resolve, this is more common to yii development. Or add it to a config to use this not the advanced one, which cannot really handle complex projects? @nvlad i know you are busy but maybe it would be a quick fix, and than many of us could use view part correctly.

our project structure is: /modules/[module]/[app]/controllers/[controller]Controller.php /modules/[module]/[app]/views/[controller]/view.php /common /backend /fronted

but app directories dose not have any controllers, views inside, only web root, and config.

now it creates the view file in controller action, but after successfully creation it does not find any more. if i am in a view render() does not complete.

i am using the latest plugin version. (i tried to use more version over time, but none of them fixed this issue)

thanks for your time!

My6UoT9 commented 5 years ago

Just discovered that removing the defined view path and root path fixes it for the advanced template. Well at least for now, hopefully it keeps working. It is probably not ideal, but at least it finds now views related correctly to backend/frontend folder.

in .idea/yii2settings.xml I just deleted those lines:

    <option name="yiiRootPath" value="C:\laragon\www\..." />
    <option name="viewPathMap">
      <map>
        <entry key="@backend/themes/*/modules" value="@backend/modules" />
        <entry key="@backend/themes/*/widgets" value="@backend/widgets" />
        <entry key="@backend/themes/*" value="@backend/views" />
        <entry key="@frontend/themes/*/modules" value="@frontend/modules" />
        <entry key="@frontend/themes/*/widgets" value="@frontend/widgets" />
        <entry key="@frontend/themes/*" value="@frontend/views" />
      </map>
    </option>

edit: 🤯10mins later and it stops working !?

aadutskevich commented 4 years ago

The only working variant found for now is to set alias like this:

Image 9

And then use alias in render function: return $this->render('@frontend/views/abc/xyz');

makbeth commented 4 years ago

Still not working. Fix it plz.

lllyx1 commented 4 years ago

Still not working. PHPStorm 2019 modules/modules/[my_name_module]/* not working only basic

rastikw commented 3 years ago

Everyone complaing about not working please check the solution from @mike-kramer from Mar 28, 2018. Adding one line in the theme path maps helps.

sokollondon commented 3 years ago

It helped for me. Clear Yii Root Path in settings. 2021-03-05_14-00-20

There is no need to change the Views settings. If you have a default structure basic or advanced template ![2021-03-05_14-05-55](https://user-images.githubusercontent.com/11624566/110092923-f7855980-7dbb-11eb-8be9-2d04160e86c9.png)

Use usual modules structure: /modules/[module]/views/[controller]/index.php The problem was. Didn't find it before. It's trying to create here: /views/[controller]/index.php (Not in module folder)

sokollondon commented 1 year ago

Version 0.10.58.52 breaks again. The decision to install version 0.10.58.37