Skip to content

[Serializer] provide functionality to config in php code #41947

Closed
@crtl

Description

@crtl

Description
At the moment it is possible to define serializer config through:

  • xml
  • yaml
  • annotations

It would be nice to have an interface/method to implement configuration in PHP classes just like Validators loadValidatorMetadata(ClassMetadataInterface $metadata): void.

Example

class ClassToSerialize {
  protected string $myProperty;

  public static function loadSerializerMetadata(ClassMetadataInterface $metadata): void 
  {
    $metadata->addProperty("myProperty", [
       "groups" => ["default"]
    ]);
  }
}

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