diff --git a/src/main/java/fr/adrienbrault/idea/symfony2plugin/routing/RouteHelper.java b/src/main/java/fr/adrienbrault/idea/symfony2plugin/routing/RouteHelper.java index f47257bf2..fb392caa0 100644 --- a/src/main/java/fr/adrienbrault/idea/symfony2plugin/routing/RouteHelper.java +++ b/src/main/java/fr/adrienbrault/idea/symfony2plugin/routing/RouteHelper.java @@ -510,7 +510,24 @@ public static Map getRoutesInsideUrlGeneratorFile(@NotNull PsiFil routeArrayOptions.add(PsiTreeUtil.getChildOfType(routeOption, ArrayCreationExpression.class)); } - routes.put(routeArray.getKey(), convertRouteConfigForReturnArray(routeArray.getKey(), routeArrayOptions)); + Route route = convertRouteConfigForReturnArray(routeArray.getKey(), routeArrayOptions); + routes.put(routeArray.getKey(), route); + + for (ArrayCreationExpression expression : routeArrayOptions) { + for (ArrayHashElement e : expression.getHashElements()) { + PhpPsiElement key = e.getKey(); + if (key != null && "'_canonical_route'".equals(key.getText())) { + PhpPsiElement value = e.getValue(); + if (value != null) { + String canonical = value.getText().replace("'", ""); + if (!routes.containsKey(canonical)) { + routes.put(canonical, route); + } + } + break; + } + } + } } }