Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Serializer] SerializedName based on groups #30483

Open
davidschmidt opened this Issue Mar 8, 2019 · 2 comments

Comments

Projects
None yet
3 participants
@davidschmidt
Copy link

davidschmidt commented Mar 8, 2019

Description
It would be helpful to be able to change the serialized name based on the serialization group.

Example

class Person
{
    /**
     * @SerializedName(name="address1", groups={"registration"})
     * @SerializedName(name="address2", groups={"update"})
     * @Groups({"registration", "update", "view"})
     * @var string
     */
    public $address;
}
@jsamouh

This comment has been minimized.

Copy link
Contributor

jsamouh commented Mar 12, 2019

maybe this would be less problematic to change the existing code:

 * @SerializedName({
 *     {"name"="Test1", "groups"={"group1"}},
 *     {"name"="Test2", "groups"={"group2"}},
*     })
@jsamouh

This comment has been minimized.

Copy link
Contributor

jsamouh commented Mar 14, 2019

in any case it is difficult to add this feature without break BC... @dunglas wdyt ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.