Skip to content

Commit bcfa1e4

Browse files
committed
Added the kernel.controller_arguments description
1 parent 0a21fa5 commit bcfa1e4

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

reference/events.rst

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,36 @@ their priorities:
7676
7777
$ php bin/console debug:event-dispatcher kernel.controller
7878
79+
``kernel.controller_arguments``
80+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
81+
82+
**Event Class**: :class:`Symfony\\Component\\HttpKernel\\Event\\FilterControllerArgumentsEvent`
83+
84+
This event is dispatched just before a controller is called. It's useful to
85+
configure the arguments that are going to be passed to the controller.
86+
Typically, this is used to map URL routing parameters to their corresponding
87+
named arguments; or pass the current request when the ``Request`` type-hint is
88+
found::
89+
90+
public function onKernelControllerArguments(FilterControllerArgumentsEvent $event)
91+
{
92+
// ...
93+
94+
// get controller and request arguments
95+
$namedArguments = $event->getRequest()->attributes->all();
96+
$controllerArguments = $event->getArguments();
97+
98+
// set the controller arguments to modify the original arguments or add new ones
99+
$event->setArguments($newArguments);
100+
}
101+
102+
Execute this command to find out which listeners are registered for this event and
103+
their priorities:
104+
105+
.. code-block:: terminal
106+
107+
$ php bin/console debug:event-dispatcher kernel.controller_arguments
108+
79109
``kernel.view``
80110
~~~~~~~~~~~~~~~
81111

0 commit comments

Comments
 (0)