Closed abienvenu closed 7 years ago
Hi @abienvenu,
I'm sorry you're experiencing problems. When I compare 1.6.0 (last known good) with 1.6.1 (first experiencing problems): https://github.com/FriendsOfSymfony/FOSJsRoutingBundle/compare/1.6.0...1.6.1 I cannot find any change that would cause your problems. Could you provide me with an example of your routing as generated by 1.6.0, and one as generated by 1.6.1?
Thank you.
Thank you for your concern. To be more precise, the problem appeared from commit 79bfd646ce5f50f07ffcc173e8bec79bda7df82a file router.js.
As requested, here is the routing generated in 1.6.0:
fos.Router.setData({
"base_url": "",
"routes": {
"dinosaurs_index": {
"tokens": [["text", "\/dinosaurs\/index"], ["variable", "\/", "[^\/]++", "_locale"]],
"defaults": [],
"requirements": [],
"hosttokens": []
},
},
"prefix": "",
"host": "www.dev.dinosaurs.fr",
"scheme": "https"
});
And with 1.6.1:
fos.Router.setData({
"base_url": "",
"routes": {
"dinosaurs_index": {
"tokens": [["text", "\/dinosaurs\/index"], ["variable", "\/", "[^\/]++", "_locale"]],
"defaults": [],
"requirements": [],
"hosttokens": [],
"methods": [],
"schemes": []
},
},
"prefix": "",
"host": "www.dev.dinosaurs.fr",
"scheme": "https"
});
With further investigation, I found that locale injection is not implemented by FOSJsRoutingBundle itself, but by custom JS code in my project. The recent change in FOSJsRoutingBundle implementation made our custom code to fail. So I guess this is a not a FOSJsRoutingBundle issue.
@abienvenu if you're using the snippet as shared by @bobvandevijver in https://github.com/FriendsOfSymfony/FOSJsRoutingBundle/issues/84#issuecomment-34876126, you can fix it by replacing the routes.a
to routes.b
. This works in our project. However, as this is not an issue in this bundle, I'm closing this issue.
When exposing a route with {_locale} inside, the locale parameter should be injected automatically (see #84). This feature was working fine with FOSJsRoutingBundle version 1.6.0, but is not working anymore with version 1.6.1, 1.6.2 and 1.6.3. We get this javascript error:
Error: The route "dinosaurs_index" requires the parameter "_locale".