8000 Allow to define a specific controller value resolver · Issue #48927 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content
Allow to define a specific controller value resolver #48927
Closed
@marforon

Description

@marforon

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:

  1. 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
  2. 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
  3. 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
{
...
}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0