diff --git a/controller.rst b/controller.rst
index 69c609ee167..f5116e023e5 100644
--- a/controller.rst
+++ b/controller.rst
@@ -241,6 +241,8 @@ the argument by its name:
bind:
# for any $logger argument, pass this specific service
$logger: '@monolog.logger.doctrine'
+ # for any $projectDir argument, pass this parameter value
+ $projectDir: '%kernel.project_dir%'
.. code-block:: xml
@@ -260,6 +262,7 @@ the argument by its name:
type="service"
id="monolog.logger.doctrine"
/>
+ %kernel.project_dir%
@@ -274,19 +277,16 @@ the argument by its name:
->setPublic(true)
->setBindings(array(
'$logger' => new Reference('monolog.logger.doctrine'),
+ '$projectDir' => '%kernel.project_dir%'
))
;
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,
- even by using ``bind``. If you need a parameter, use the ``$this->getParameter('kernel.debug')``
- shortcut or pass the value through your controller's ``__construct()`` method
- and specify its value with ``bind``.
+.. versionadded:: 4.1
+ The ability to bind scalar values to controller arguments was introduced in
+ Symfony 4.1. Previously you could only bind services.
For more information about services, see the :doc:`/service_container` article.