From 72a0685aa40c0a8bde6ccfdde040c5273f1dad16 Mon Sep 17 00:00:00 2001 From: Ryan Weaver Date: Sun, 29 Oct 2017 14:17:31 -0400 Subject: [PATCH] Adding warning about non-service arguments --- controller.rst | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/controller.rst b/controller.rst index 832a843b752..1ed5a479ac6 100644 --- a/controller.rst +++ b/controller.rst @@ -338,6 +338,13 @@ controller's service config: You can of course also use normal :ref:`constructor injection ` in your controllers. +.. caution:: + + You can *only* pass *services* to your controller arguments in this way. It's + not possible, for example, to pass a service parameter as a controller argument. + If you need a parameter, use the ``$this->getParameter('kernel.debug')`` shortcut + or pass the value through your controller's ``__construct()`` method. + For more information about services, see the :doc:`/service_container` article. .. _controller-service-arguments-tag: