80

When using the Symfony2 plugin for PHPStorm, I sometimes see a Weak Route warning: Weak route

What does it mean?

Vladislav Rastrusny
  • 29,378
  • 23
  • 95
  • 156
Tamlyn
  • 22,122
  • 12
  • 111
  • 127

4 Answers4

123

Worked it out. The Symfony2 plugin parses the appDevDebugProjectContainer.php file to get route and service information. However this file is only recompiled when the web page is loaded which means newly created routes are not included.

To get around this the plugin also parses the config files but this is not 100% reliable so routes discovered in this way are marked as "weak". Reloading the web page will make the warning go away.

Tamlyn
  • 22,122
  • 12
  • 111
  • 127
  • 14
    Thanks for answering your own post, 2 seconds later after googling I have my answer :-) – Adam Dec 17 '14 at 01:08
  • Is there any way to suppress this warning? I'm getting it for all routes in PHPStorm10 – Acyra Nov 15 '15 at 15:46
  • 4
    OK to suppress this warning, Settings->Editor->Inspections->Symfony->Route to turn it off – Acyra Nov 15 '15 at 15:54
9

I finally fixed this issue for my situation (Symfony 2.8 / PhpStorm 2016.3).

It's similar to @Atmarama 's solution but I think my version of PhpStorm (2016.3) is different and/or Symfony 2.8.

My solution also doesn't involve the deprecated setting. I hope this will help others:

In PhpStorm go to Languages & Frameworks > PHP > Symfony > Routing and add the path to appDevProjectContainerUrlGenerator.php.

In my case this is:

var/cache/dev/appDevDebugProjectContainerUrlGenerator.php

PhpStorm 2016.3 settings to fix weak route issue

Graftak
  • 691
  • 7
  • 16
3

Check path to file urlGenerator

For me right path is:

var/cache/dev/appDevDebugProjectContainerUrlGenerator.php

And after make click to button "Clear Index" above

enter image description here

anydasa
  • 2,616
  • 1
  • 15
  • 13
-1

I also get the same problem and in my case, because i use '/' to declare the render template instead of ":" Changing from "/" to ":" cleared that warning in my case

Jack Vo
  • 319
  • 2
  • 14