Skip to content
Advertisement

Symfony2 Accessing route variables

I know I can access current route name by $request->get('_route');.

If my route is defined this way:

JavaScript

How can I retrieve the id variable from within service?

Advertisement

Answer

$request->attributes->get('id') does the trick.

User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement