Closed
Description
Description
As part of the recent bug, I would like to propose a new feature to specify a specific controller value resolver which should be forced instead of iterating the whole stack of value resolvers.
I have multiple reasons for this:
- bad performance architecture - each value resolver might be iterated until the first is used. I understand it's simple to use, but we don't have to break the current system, we can just add a possibility to skip the iteration
- we shouldn't embrace a priority system for third-party bundles - a bundle "A" might setup its value resolver to some priority, but a bundle "B" might setup the same priority, there is no way to predict all cases to not create some type of collision, each bundle should be able to define a specific value resolver and be sure it will be always used
- Sensio Extra Bundle had this ability to specify a converter which was always used instead of priority
Example
public function __invoke(Request $request, #[ValueResolver(EntityValueResolver::class)] Entity $entity): Response
{
...
}
or for a different resolver:
public function __invoke(Request $request, #[ValueResolver(SerializerValueResolver::class)] Entity $entity): Response
{
...
}