yii2support icon indicating copy to clipboard operation
yii2support copied to clipboard

The extension can not see the view files

Open slepciu opened this issue 6 years ago • 22 comments

What steps will reproduce the problem?

In IDE, I have to emphasize that the view does not exist. However, it exists and works what I checked by running the application. The controller is in the path: E: \ project \ rts \ api \ app \ public \ cron \ controllers \ GrantDbController.php The view is in the path: E: \ project \ rts \ api \ app \ public \ cron \ views \ grant-db \ show-compare.php Error response line: return $ this-> render ('show-compare'); In the Yii plugin settings, the root path is set to: E: \ project \ rts \ client \ app \ public

Themes path map: @ app / themes / * -> @ app / views

Q A
IDE Name PhpStorm
IDE Version 2017.3.4
Plugin version 0.8.42.3

slepciu avatar Mar 19 '18 10:03 slepciu

What Yii template using? yii-app-basic or yii-app-advanced? What namespace for GrantDbController.php?

nvlad avatar Mar 19 '18 12:03 nvlad

what path in error?

image

nvlad avatar Mar 19 '18 13:03 nvlad

The same issue. screenshot_343

vtvz avatar Mar 20 '18 12:03 vtvz

@vtvz Your have setup Yii root? What Yii template using? yii-app-basic or yii-app-advanced? Need more details of project structure.

nvlad avatar Mar 20 '18 12:03 nvlad

@nvlad I started from blank project without any templates (To be fair I injected Yii2 to existing non Yii2 project). But it's looks like basic template a little bit.

Project structure looks like this:

www
| - app
|   | - config (folder)
|   | - console (folder)
|   | - models (folder)
|   | - web
|   |   | - controllers (folder)
|   |   | - views (folder)
|   | - yii (executable file)

Yes. I setup Yii root. Tried empty, www folder and www/app (full path of couse)

Does not use any templates. Pure PHP.

vtvz avatar Mar 20 '18 13:03 vtvz

@vtvz your controller located at web/controllers namespace?

Please test dev build with fix for your trouble (may be).

Plugin in attached archive: yii2support.zip

nvlad avatar Mar 20 '18 13:03 nvlad

Error occurred: Message:

Error while indexing /home/path/to/project/www/c3.php

Details:

Error while indexing /home/path/to/project/www/c3.php
To reindex this file IDEA has to be restarted: String index out of range: -56
java.lang.StringIndexOutOfBoundsException: String index out of range: -56
	at java.lang.String.substring(String.java:1967)
	at com.nvlad.yii2support.common.YiiApplicationUtils.getApplicationName(YiiApplicationUtils.java:52)
	at com.nvlad.yii2support.views.util.ViewUtil.resolveView(ViewUtil.java:51)
	at com.nvlad.yii2support.views.index.ViewFileIndex$ViewDataIndexer.map(ViewFileIndex.java:84)
	at com.nvlad.yii2support.views.index.ViewFileIndex$ViewDataIndexer.map(ViewFileIndex.java:78)
	at com.intellij.util.indexing.impl.MapReduceIndex.mapInput(MapReduceIndex.java:273)
	at com.intellij.util.indexing.VfsAwareMapReduceIndex.calculateUpdateData(VfsAwareMapReduceIndex.java:98)
	at com.intellij.util.indexing.impl.MapReduceIndex.update(MapReduceIndex.java:213)
	at com.intellij.util.indexing.FileBasedIndexImpl.a(FileBasedIndexImpl.java:1654)
	at com.intellij.util.indexing.FileBasedIndexImpl.a(FileBasedIndexImpl.java:1582)
	at com.intellij.openapi.fileTypes.impl.FileTypeManagerImpl.freezeFileTypeTemporarilyIn(FileTypeManagerImpl.java:511)
	at com.intellij.util.indexing.FileBasedIndexImpl.a(FileBasedIndexImpl.java:1541)
	at com.intellij.util.indexing.FileBasedIndexImpl.indexFileContent(FileBasedIndexImpl.java:1529)
	at com.intellij.util.indexing.UnindexedFilesUpdater.a(UnindexedFilesUpdater.java:109)
	at com.intellij.openapi.project.CacheUpdateRunner$MyRunnable.a(CacheUpdateRunner.java:227)
	at com.intellij.openapi.application.impl.ApplicationImpl.tryRunReadAction(ApplicationImpl.java:1127)
	at com.intellij.openapi.project.CacheUpdateRunner$MyRunnable.a(CacheUpdateRunner.java:243)
	at com.intellij.openapi.progress.impl.CoreProgressManager.a(CoreProgressManager.java:157)
	at com.intellij.openapi.progress.impl.CoreProgressManager.a(CoreProgressManager.java:543)
	at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:488)
	at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:94)
	at com.intellij.openapi.progress.impl.CoreProgressManager.runProcess(CoreProgressManager.java:144)
	at com.intellij.openapi.project.CacheUpdateRunner$MyRunnable.run(CacheUpdateRunner.java:240)
	at com.intellij.openapi.application.impl.ApplicationImpl$1.run(ApplicationImpl.java:315)
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
	at java.lang.Thread.run(Thread.java:745)

The same error with views

vtvz avatar Mar 20 '18 13:03 vtvz

I think I am having this same issue. I am using the Yii2 Advanced Template. Getting false positives by this detection. View file for "select" not found in "/advanced/views/payment-method/select.php" . The correct path for that file is "/advanced/frontend/views/payment-method/select.php"

craiglondon avatar Mar 20 '18 15:03 craiglondon

@craiglondon your Yii project located at root PhpStorm project?

nvlad avatar Mar 20 '18 21:03 nvlad

Check latest release (v0.8.42.5)

nvlad avatar Mar 20 '18 22:03 nvlad

@nvlad Nothing was changed. The same problem happens. image // Прости меня за ужасный английский. Короче, все та же ерунда. Не зависимо от того, какой Yii2 Root я указываю. Использую, ествесственно, самую последнюю версию всего

vtvz avatar Mar 21 '18 09:03 vtvz

This appears to be resolved on 0.8.42.5 and configuring the Yii Root Path.

craiglondon avatar Mar 21 '18 17:03 craiglondon

@nvlad apologize for the long response time. I've updated the extension (0.8.42.5), but it's still the same. Namespace for GrantDbController.php -> cron\controllers I used yii-app-advanced, but I have a slightly changed directory structure. All files with configuration and parameters have in 2 directories in the main folder public ├── mainApp ├── common
├── config
├── console
├── cron
├── configLocal
├── vendor
├── yii

slepciu avatar Mar 23 '18 16:03 slepciu

Im am having the same issue on all my views. Im using advanced template. The view is in src/frontend/views/estimates/create.php and works fine but the plugin seems to be skipping any endpoint folder.. in my case frontend is not added into the plugin's path.

image

jeffersoncechinel avatar Mar 25 '18 19:03 jeffersoncechinel

Hi there! I just updated the plugin and configured the root project folder and now everything works fine! Please ignore my last comment. Thank you!

jeffersoncechinel avatar Mar 25 '18 19:03 jeffersoncechinel

@nvlad I have updated the plugin to version 0.8.42.6 and is already correctly checking the existence of the view. Unfortunately, when he does not find the view and tries to create it, he creates the file in the wrong place. It should be found here: image

Instead, it creates a new directory structure in the main Yii directory:

image

Config: image

slepciu avatar Apr 16 '18 19:04 slepciu

2018-09-18_17-05-47 PhpStorm 2018.2.3 Yii2 template basic image image image the problem has appeared after updating PhpStorm

sallfris avatar Sep 18 '18 14:09 sallfris

Проблема решилась путем добавления пустой папки controllers в корень проекта. И воспроизводится если ее удалить.

sallfris avatar Sep 18 '18 15:09 sallfris

Короче как я понял проблема тут image Если в корне не найдена папка controllers то считается что это шаблон advanced и корневой директорией назначается первая папка из пути к файлу от корня проекта. Хз как исправить логику, но помогает добавление папки в корень. Скорей всего у @slepciu та же беда, но у него закрашено и не понятно есть ли папка

sallfris avatar Sep 18 '18 16:09 sallfris

Maybe it will help image

slepciu avatar Sep 19 '18 06:09 slepciu

@slepciu if you use advanced template, you need set phpstorm sources folders and set package prefix image

sallfris avatar Sep 19 '18 13:09 sallfris

It works

slepciu avatar Oct 12 '18 09:10 slepciu