Documentation

ContextAwareDenormalizerInterface extends DenormalizerInterface

Adds the support of an extra $context parameter for the supportsDenormalization method.

Tags
author

Kévin Dunglas dunglas@gmail.com

Table of Contents

Constants

COLLECT_DENORMALIZATION_ERRORS  = 'collect_denormalization_errors'

Methods

denormalize()  : mixed
Denormalizes data back into an object of the given class.
supportsDenormalization()  : bool
Checks whether the given class is supported for denormalization by this normalizer.

Constants

COLLECT_DENORMALIZATION_ERRORS

public mixed COLLECT_DENORMALIZATION_ERRORS = 'collect_denormalization_errors'

Methods

denormalize()

Denormalizes data back into an object of the given class.

public denormalize(mixed $data, string $type[, string $format = null ][, array<string|int, mixed> $context = [] ]) : mixed
Parameters
$data : mixed

Data to restore

$type : string

The expected class to instantiate

$format : string = null

Format the given data was extracted from

$context : array<string|int, mixed> = []

Options available to the denormalizer

Tags
throws
BadMethodCallException

Occurs when the normalizer is not called in an expected context

throws
InvalidArgumentException

Occurs when the arguments are not coherent or not supported

throws
UnexpectedValueException

Occurs when the item cannot be hydrated with the given data

throws
ExtraAttributesException

Occurs when the item doesn't have attribute to receive given data

throws
LogicException

Occurs when the normalizer is not supposed to denormalize

throws
RuntimeException

Occurs if the class cannot be instantiated

throws
ExceptionInterface

Occurs for all the other cases of errors

supportsDenormalization()

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

public supportsDenormalization(mixed $data, string $type[, string $format = null ][, array<string|int, mixed> $context = [] ]) : bool
Parameters
$data : mixed

Data to denormalize from

$type : string

The class to which the data should be denormalized

$format : string = null

The format being deserialized from

$context : array<string|int, mixed> = []

options that denormalizers have access to

Return values
bool

        
On this page

Search results