Skip to content

Commit

Permalink
Add the missing note on how to inject a service into the controller
Browse files Browse the repository at this point in the history
  • Loading branch information
wkania committed Aug 14, 2024
1 parent 319b504 commit e015131
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion controller.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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' </controller/service>`::

use Psr\Log\LoggerInterface;
use Symfony\Component\HttpFoundation\Response;
Expand Down

0 comments on commit e015131

Please sign in to comment.