How do I get the current route in Symfony 2?
For example, routing.yml
:
somePage:
pattern: /page/
defaults: { _controller: "AcmeBundle:Test:index" }
How can I get this somePage
value?
From something that is ContainerAware (like a controller):
$request = $this->container->get('request');
$routeName = $request->get('_route');