I want to automatically add routes from my bundle without adding a link to my bundle's routing scheme into routing.yml. For example, this can be admin's bundle. Each application that use this bundle will get special /admin/xxx routes without manual editing of routing scheme.
For services it's pretty easy with overriding of Extension->load() method, but for routing I couldn't find a solution.
How can I implement desired feature?
At the moment you can't easily hook into the routing like that from a Bundle, that's why the framework stuff itself like the profiler and web debug toolbar have to be included from the routing_dev.yml file.
However it would be doable I believe to add an event dispatched when the routing is parsed I guess, allowing bundles to hook into it to add their own routes to the RouteCollection. I created an issue to that effect on the Symfony tracker.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With