Cannot resolve files/directories in a MVC pattern
Hello,
I'm having trouble having PHP Storm resolve files or directories while coding a PHP application using the MVC pattern (Model View Controller) with a router.
The pattern itself induces the use of a lot of ‘require’ that are interwoven into each other, which seem to be causing the issue. Is there anyway to fix that ? It's creating unnecessary warnings and is preventing me from using the ‘jump to source’ (F4) function.
Here's an example:
*The file tree is as such.

* I have a router file at the root of the project, which requires the ordersController.php and call a function newOrder() in a controller.
- router.php

* The controller then calls for a view, and I get the warning.
- ordersController.php

I cannot enter the relative path of the newOrderView.php file seen from the ordersController.php file (which would be ‘../views/orders/newOrderView.php’), because it is called from the main router file as the controller is required at the beginning of it.
Thank you for your help,
Samy
请先登录再写评论。
Hi Samy,
In theory, such cases could be resolved by Resource Roots functionality once the following request will be implemented:
https://youtrack.jetbrains.com/issue/WI-74287/Take-into-account-resource-roots-in-include-require-statements-path-resolution
Also, please check the following discussion:
https://intellij-support.jetbrains.com/hc/en-us/community/posts/13095706631058-Specifying-internal-include-paths-to-get-rid-of-the-Path-not-found-warnings-