Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

[6.2] [doctrine-bridge] EntityValueResolver priority is too high and there is no way to be skipped by a custom ParamCoverter #48433

Copy link
Copy link
Closed
@marforon

Description

@marforon
Issue body actions

Symfony version(s) affected

6.2

Description

EntityValueResolver introduced in Symfony 6.2 priority (110) is higher than RequestAttributeValueResolver priority (100) which makes ParamConverter unusable in some cases. Only UserValueResolver has a higher priority.

How to reproduce

Consider this controller action:

    #[Route('/asset-file/{assetFile}/distribute', name: 'distribute', methods: [Request::METHOD_POST])]
    #[ParamConverter('jwDistribution', converter: SerializerParamConverter::class)]
    public function distribute(AssetFile $assetFile, JwDistribution $jwDistribution): JsonResponse
    {
           return new JsonResponse();
    }

In this case, AssetFile and JwDistribution represent Doctrine's entities, but JwDistribution doesn't exist in repository and should be converted by a custom converter (serializer). Instead, EntityValueResolver is used also for JwDistribution and it obviously fails to convert (because it's entity object without identifier). That must be at least some kind of regression. Could we do something about it?

Possible Solution

At least
RequestAttributeValueResolver should has a higher priority than EntityValueResolver.

Additional Context

No 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

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.