Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[Serializer] Attribute SerializedName ignored when property name is the same as the related (get|has|can) method #54109

Closed
@systemasis

Description

@systemasis

Symfony version(s) affected

7.0.*

Description

Symfony serializer ignores the attribute SerializedName for properties sharing the same name as the related method shall it start by can, has or get.

How to reproduce

Clone this repository created specifically and use the following command :

bin/console app:test:test

This will output the string of a json serialized App\Entity\ListView object.

Expected output :

"{"free_trial":true,"can_subscribe":false,"has_answers":true,"get_ready":false}"

Current output :

"{"free_trial":true,"subscribe":false,"answers":true,"ready":false}"

Possible Solution

No response

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