8000 Merge branch '3.3' into 3.4 · symfony/symfony-docs@d7ee5d5 · GitHub
[go: up one dir, main page]

Skip to content

Commit d7ee5d5

Browse files
committed
Merge branch '3.3' into 3.4
* 3.3: Adding warning about non-service arguments
2 parents 5476202 + 656980b commit d7ee5d5

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

controller.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -338,6 +338,13 @@ controller's service config:
338338
You can of course also use normal :ref:`constructor injection <services-constructor-injection>`
339339
in your controllers.
340340

341+
.. caution::
342+
343+
You can *only* pass *services* to your controller arguments in this way. It's
344+
not possible, for example, to pass a service parameter as a controller argument.
345+
If you need a parameter, use the ``$this->getParameter('kernel.debug')`` shortcut
346+
or pass the value through your controller's ``__construct()`` method.
347+
341348
For more information about services, see the :doc:`/service_container` article.
342349

343350
.. _controller-service-arguments-tag:

0 commit comments

Comments
 (0)
0