Routes not found in PhpStorm, Symfony2 and FOSRestBundle

微笑、不失礼 提交于 2019-12-24 06:18:11

问题


I'm using latest PhpStorm with the Symfony2 plugin on a Symfony 3.2 project and FOSRestBundle.

The routes generated by the FOSRestBundle don't get resolved automatically in PhpStorm (you get "missing route") although the routes work fine and show up with php bin/console debug:router

Has anyone found a trick to get them to show as good routes? It's not blocking me from anything, just a visual thing.

Update: Appears to be working except for explicitly named routes. I had forgotten (or not thought it was relevant) that my route was defined explicitly, so:

@Rest\Route("/doc/{id}/status", name="_current_doc_status")

Debug:router would actually show this as get_current_doc_status because FOSRestBundle's Get would be prepended, and get_current_doc_status would work in the code just fine, it's just resolving it.

Removing the custom name and letting Symfony do the route itself will resolve (and also work), so the issue may be specific to custom named routes + FOSRestBundle


回答1:


if you have new directory structure, the folder cache is in var folder. So in Path to urlGenerator.php is var/cache/dev/appDevDebugProjectContainerUrlGenerator.php



来源:https://stackoverflow.com/questions/40917416/routes-not-found-in-phpstorm-symfony2-and-fosrestbundle

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!