From e0151319c6302ffa39a272684ed2dd3732a592e1 Mon Sep 17 00:00:00 2001 From: Wojciech Kania Date: Wed, 14 Aug 2024 23:12:46 +0200 Subject: [PATCH] Add the missing note on how to inject a service into the controller --- controller.rst | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/controller.rst b/controller.rst index 7866a97818b..6dc2bea4f88 100644 --- a/controller.rst +++ b/controller.rst @@ -178,7 +178,8 @@ These are used for rendering templates, sending emails, querying the database an any other "work" you can think of. If you need a service in a controller, type-hint an argument with its class -(or interface) name. Symfony will automatically pass you the service you need:: +(or interface) name. Symfony will automatically pass you the service you need. +Make sure to :doc:`register the controller as a service or tag it with 'controller.service_arguments' `:: use Psr\Log\LoggerInterface; use Symfony\Component\HttpFoundation\Response;