Inform about JMSI18nRoutingBundle compatibility #352
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I've spent the last day trying to figure out why routes could not be dumped anymore to JS in my app.
I'm hoping to save hours of trouble for other developers who would encounter the exact same issue.
exposed domain feature introduced in FOSJsRoutingBundle 2.3.0 unfortunately prevents dumping JMSI18nRoutingBundle internationalized routes.
The exposed routes defined in
app/config/config.yml
are now transformed into a regular expression:The problem when using JMSI18nRoutingBundle is that the names of the routes are locale-prefixed, so that in the loop through all routes:
The variable
$name
would not beroute_1
orroute_2
, such as defined inapp/config/config.yml
, but ratheren__RG__route_1
oren__RG__route_2
.So when populating the
$matches
array using the original routes names and then attempting to get their corresponding domain using the locale-prefixed routes names, well, that returnsnull
and continues the loop:After some thoughts, I've stumbled upon a very easy solution consisting in adapting the routes defined in
app/config/config.yml
so that they would be used as locale-prefixed in the loop!Tada :)
I hope that it's the right place to inform about this issue, please let me know otherwise, thank you.