Add serialization group to vendor's class property

201 views Asked by At

I'm using doctrine2-spatial in api-platform.

For the CrEOF\Spatial\PHP\Types\AbstractPoint class, I need to add a serialization group for $x and $y properties.

What would be the best way to accomplish this without altering the vendor?

1

There are 1 answers

3
goto On

In the serializer documentation, they provide example in comment to use yml and xml) mapping for serialization group. This way you can add some serialization group pointing to the vendor entity without having to use the annotation in the vendor classes

$classMetadataFactory = new ClassMetadataFactory(new YamlFileLoader('/path/to/your/definition.yml'));