I know I can access current route name by $request->get('_route');
.
If my route is defined this way:
/* * @Route("/get_by_category/{id}", defaults={"id" = 0}, name="get_products_by_category") */
How can I retrieve the id
variable from within service?
Advertisement
Answer
$request->attributes->get('id')
does the trick.