File tree Expand file tree Collapse file tree 1 file changed +33
-0
lines changed Expand file tree Collapse file tree 1 file changed +33
-0
lines changed Original file line number Diff line number Diff line change @@ -25,6 +25,39 @@ in method parameters:
2525 resource : ' ../src/Controller/'
2626 tags : ['controller.service_arguments']
2727
28+ .. note ::
29+
30+ If you don't use either :doc: `autowiring </service_container/autowiring >`
31+ or :ref: `autoconfiguration <services-autoconfigure >` and you extend the
32+ ``AbstractController ``, you'll need to apply other tags and make some method
33+ calls to register your controllers as services:
34+
35+ .. code-block :: yaml
36+
37+ # config/services.yaml
38+
39+ # this extended configuration is only required when not using autowiring/autoconfiguration,
40+ # which is uncommon and not recommended
41+
42+ abstract_controller.locator :
43+ class : Symfony\Component\DependencyInjection\ServiceLocator
44+ arguments :
45+ -
46+ router : ' @router'
47+ request_stack : ' @request_stack'
48+ http_kernel : ' @http_kernel'
49+ session : ' @session'
50+ parameter_bag : ' @parameter_bag'
51+ # you can add more services here as you need them (e.g. the `serializer`
52+ # service) and have a look at the AbstractController class to see
53+ # which services are defined in the locator
54+
55+ App\Controller\ :
56+ resource : ' ../src/Controller/'
57+ tags : ['controller.service_arguments']
58+ calls :
59+ - [setContainer, ['@abstract_controller.locator']]
60+
2861 If you prefer, you can use the ``#[AsController] `` PHP attribute to automatically
2962apply the ``controller.service_arguments `` tag to your controller services::
3063
You can’t perform that action at this time.
0 commit comments