Skip to content

Serializing properties without groups #2939

Description

@kingschnulli

This maybe related to the serializer, but I'm a bit unsure so I'm asking this question here. Let's say I have an entity Book:

/**
 * @ApiResource()
 */
class Book
{
    /**
     * @Groups({"read", "write"})
     */
    public $name;

    /**
     * @Groups("write")
     */
    public $author;

    /**
     * This property has no groups
     */
    public $foo;

    // ...
}

What I'm trying to achieve now is to serialize the $foo property, regardless of the current context groups. Is there some way to configure some kind of "default group" for properties where no group was given?

I know I could just add the group to my property, but I was hoping to configure something (or decorate something) so the serializer will return the property $foo.

TLDR: How can I define a default group for all properties?

No activity

Activity on this issue will appear here.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions