interface DenormalizerInterface

Constants

COLLECT_DENORMALIZATION_ERRORS

Methods

mixed
denormalize(mixed$data,string$type,string|null$format =null,array$context =[])

Denormalizes data back into an object of the given class.

bool
supportsDenormalization(mixed$data,string$type,string|null$format =null,array$context =[])

Checks whether the given class is supported for denormalization by this normalizer.

array
getSupportedTypes(string|null$format)

Returns the types potentially supported by this denormalizer.

Details

mixed denormalize(mixed$data,string$type,string|null$format =null,array$context =[])

Denormalizes data back into an object of the given class.

Parameters

mixed $data Data to restore
string $type The expected class to instantiate
string|null $format Format the given data was extracted from
array $context Options available to the denormalizer

Return Value

mixed

Exceptions

BadMethodCallException Occurs when the normalizer is not called in an expected context
InvalidArgumentException Occurs when the arguments are not coherent or not supported
UnexpectedValueException Occurs when the item cannot be hydrated with the given data
ExtraAttributesException Occurs when the item doesn't have attribute to receive given data
LogicException Occurs when the normalizer is not supposed to denormalize
RuntimeException Occurs if the class cannot be instantiated
ExceptionInterface Occurs for all the other cases of errors

bool supportsDenormalization(mixed$data,string$type,string|null$format =null,array$context =[])

Checks whether the given class is supported for denormalization by this normalizer.

Parameters

mixed $data
string $type
string|null $format
array $context

Return Value

bool

array getSupportedTypes(string|null$format)

Returns the types potentially supported by this denormalizer.

For each supported formats (if applicable), the supported types should be returned as keys, and each type should be mapped to a boolean indicating if the result of supportsDenormalization() can be cached or not (a result cannot be cached when it depends on the context or on the data.) A null value means that the denormalizer does not support the corresponding type.

Use type "object" to match any classes or interfaces, and type "*" to match any types.

Parameters

string|null $format

Return Value

array bool|null>