core
core copied to clipboard
fix: support empty array as object
Supersedes https://github.com/api-platform/core/pull/4363.
Fixes an issue with the use of EMPTY_ARRAY_AS_OBJECT and PRESERVE_EMPTY_OBJECTS in the serialization context.
Since the Hydra CollectionNormalizer was taking over the serialization of all iterables for the JSON-LD format, the Symfony serializer was not called when normalizing a "raw" collection.
Adding a better supports method fixes the issue.