class SerializerRegistry (View source)

Registry for managing entity-specific serializers.

Implements the strategy pattern to find the appropriate serializer for each entity type.

Methods

void
register(EntityTypeSerializerInterface $serializer)

Register a new entity serializer.

findSerializer(mixed $entity)

Find a serializer that supports the given entity.

array
getAllSerializers()

Get all registered serializers.

Details

void register(EntityTypeSerializerInterface $serializer)

Register a new entity serializer.

Parameters

EntityTypeSerializerInterface $serializer

Return Value

void

EntityTypeSerializerInterface|null findSerializer(mixed $entity)

Find a serializer that supports the given entity.

Parameters

mixed $entity

The entity to find a serializer for

Return Value

EntityTypeSerializerInterface|null

The matching serializer, or null if none found

array getAllSerializers()

Get all registered serializers.

Return Value

array