I'd like to extend base router functionality to support more complex url parameters. In order to do that, I've found that I can override following configuration parameters:
with my own classes extending symfony2 native ones.
It's great that I can do something like that just using configuration parameters and overriding doGetArguments and doGenerate methods to handle more complex arguments and pass the rest to native Symfony2 code.
Unfortunately, both of those classes needs to check action annotations for my custom annotation configuring options for whole process to be customizable. But, unfortunately, those classes aren't handled by DI container but their names are injected to router and router just instantiates them with hard-coded parameters so it's impossible to reach doctrine annotation reader from inside them without nasty hacks.
My questions are following:
1. Why Symfony\Bundle\FrameworkBundle\Controller\ControllerResolver and Symfony\Component\Routing\Generator\UrlGenerator instances aren't injected by DI container? They could be services - it would follow Symfony principles in my opinion.
2. How to reach DI container from inside them?
3. Is there a better way to achieve what I'm trying to achieve?