Interface

Symfony\Component\Serializer\Normalizer\NormalizableInterface

interface NormalizableInterface

Defines the most basic interface a class must implement to be normalizable

If a normalizer is registered for the class and it doesn't implement the Normalizable interfaces, the normalizer will be used instead

Methods

array|scalar normalize(SerializerInterface $serializer, string|null $format = null)

Normalizes the object into an array of scalars|arrays.

denormalize(SerializerInterface $serializer, array|scalar $data, string|null $format = null)

Denormalizes the object back from an array of scalars|arrays.

Details

at line 38
public array|scalar normalize(SerializerInterface $serializer, string|null $format = null)

Normalizes the object into an array of scalars|arrays.

It is important to understand that the normalize() call should normalize recursively all child objects of the implementor.

Parameters

SerializerInterface $serializer The serializer is given so that you can use it to normalize objects contained within this object.
string|null $format The format is optionally given to be able to normalize differently based on different output formats.

Return Value

array|scalar

at line 52
public denormalize(SerializerInterface $serializer, array|scalar $data, string|null $format = null)

Denormalizes the object back from an array of scalars|arrays.

It is important to understand that the normalize() call should denormalize recursively all child objects of the implementor.

Parameters

SerializerInterface $serializer The serializer is given so that you can use it to denormalize objects contained within this object.
array|scalar $data The data from which to re-create the object.
string|null $format The format is optionally given to be able to denormalize differently based on different input formats.