-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
Description
Description
I saw that @stof created this #18440 PR about adding the new event for the controller arguments.
This is a very useful feature that I would like to use..
What i'd like to achieve is before reaching to the ArgumentResolver to use this event to do some api calls and load some objects.
Then my ArgumentResolver could check from a container that I have if those objects are loaded and if they are then they should be resolved otherwise the flow of the framework must throw exception.
Unfortunately this event is running after the ArgumentResolver.
This order of this raises some questions to me.
- In the documentation it says:
https://symfony.com/doc/current/reference/events.html#kernel-controller-arguments
This event is dispatched just before a controller is called. It's useful to configure the arguments that are going to be passed to the controller. Typically, this is used to map URL routing parameters to their corresponding named arguments; or pass the current request when the Request type-hint is found:
How am I supposed to map the URL parameters to my controller parameters... ?? At the moment when a parameter is not nullable AND no Argument resolver can resolve it then (at least at my application) the ServiceValueResolver
throws an exception.
-
Is the current order (meaning executing the event after the ArgumentResolver) made by design?
What i'd like to achieve is before reaching to the ArgumentResolver to use this event to do some api calls and load some objects.
I could do the same inside an ArgumentResolver when the support
function is called but if the API fails then an exception must be thrown.. and in general it feels kinda dirty.
Anyway is it possible to change the order inside the HttpKernel?