Haehnchen / idea-php-symfony2-plugin

IntelliJ IDEA / PhpStorm Symfony Plugin
https://plugins.jetbrains.com/plugin/7219
MIT License
911 stars 137 forks source link

Plugin not recognizing localized routes #2247

Closed tjveldhuizen closed 8 months ago

tjveldhuizen commented 9 months ago

The plugin seems to have problems handling localized routes. In this example, the route name in all three of the generated URL's is valid (and working in my application), but only links to a specific locale are found by the plugin.

image

damienalexandre commented 8 months ago

I can confirm this issue.

image

I suspect this is due to the way Symfony is storing those routes inside /var/cache/dev/url_generating_routes.php:

[ // ...
    'profile_plan.en' => [[], [
        '_controller' => 'App\\Controller\\ProfileController::plan', 
        '_locale' => 'en', 
        '_canonical_route' => 'profile_plan'
    ], [], [['text', '/account/plan']], [], [], []],
    'profile_plan.fr' => [[], [
        '_controller' => 'App\\Controller\\ProfileController::plan', 
        '_locale' => 'fr', 
        '_canonical_route' => 'profile_plan'
    ], [], [['text', '/fr/account/plan']], [], [], []],

I think the plugin should look at the _canonical_route option. When it's set, it means this route is a translation of a base route.

damienalexandre commented 8 months ago

It looks like a fix has been merged for this here: https://github.com/Haehnchen/idea-php-symfony2-plugin/pull/2266

I just updated and it fix the issue for me! Thanks!

tjveldhuizen commented 8 months ago

Indeed! Great!