-
-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Documented the new kernel.controller_arguments event #6434
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -80,6 +80,33 @@ Listener Class Name | |
:class:`Symfony\\Bundle\\FrameworkBundle\\DataCollector\\RequestDataCollector` 0 | ||
============================================================================== ======== | ||
|
||
``kernel.controller_arguments`` | ||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
|
||
.. versionadded:: 3.1 | ||
The ``kernel.controller_arguments`` event was introduced in Symfony 3.1. | ||
|
||
**Event Class**: :class:`Symfony\\Component\\HttpKernel\\Event\\FilterControllerArgumentsEvent` | ||
|
||
This event can be an entry point used to modify the arguments of the controller | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would remove "an entry point". There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fixed. Thanks. |
||
once they have been resolved by Symfony:: | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. namespace is missing, otherwise its not very clear where to put this method IMO There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. you can put it where you want (as long as you tell Symfony that this method is a listener for this event) . And the current proposal is consistent with other snippets in the page |
||
use Symfony\Component\HttpKernel\Event\FilterControllerArgumentsEvent; | ||
|
||
public function onKernelControllerArguments(FilterControllerArgumentsEvent $event) | ||
{ | ||
$controller = $event->getController(); | ||
$arguments = $event->getArguments(); | ||
// ... | ||
|
||
// the arguments can be changed as needed | ||
$event->setArguments(array('foo', 'bar')); | ||
} | ||
|
||
.. seealso:: | ||
|
||
Read more on the :ref:`kernel.controller_arguments event <component-http-kernel-kernel-controller-arguments>`. | ||
|
||
``kernel.view`` | ||
~~~~~~~~~~~~~~~ | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it now also allows to replace the controller
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've reworded this. Thanks!