final class Serializer extends Serializer (View source)

internal  JSON:API maintains no PHP API since its API is the HTTP API. This class may change at any time and this will break any dependencies on it.
 

Overrides the Symfony serializer to cordon off our incompatible normalizers.

This service is for internal use only. It is not suitable for any reuse. Backwards compatibility is in no way guaranteed and will almost certainly be broken in the future.

Properties

protected NormalizerInterface|DenormalizerInterface $fallbackNormalizer

A normalizer to fall back on when JSON:API cannot normalize an object.

Methods

__construct(array $normalizers = [], array $encoders = [])

{@inheritdoc}

setFallbackNormalizer(NormalizerInterface $normalizer)

Adds a secondary normalizer.

normalize($data, $format = NULL, array $context = [])

{@inheritdoc}

denormalize($data, $type, $format = NULL, array $context = [])

{@inheritdoc}

supportsNormalization($data, $format = NULL, array $context = [])

{@inheritdoc}

supportsDenormalization($data, $type, $format = NULL, array $context = [])

{@inheritdoc}

Details

__construct(array $normalizers = [], array $encoders = [])

{@inheritdoc}

Parameters

array $normalizers
array $encoders

setFallbackNormalizer(NormalizerInterface $normalizer)

Adds a secondary normalizer.

This normalizer will be attempted when JSON:API has no applicable normalizer.

Parameters

NormalizerInterface $normalizer

The secondary normalizer.

normalize($data, $format = NULL, array $context = [])

{@inheritdoc}

Parameters

$data
$format
array $context

denormalize($data, $type, $format = NULL, array $context = [])

{@inheritdoc}

Parameters

$data
$type
$format
array $context

supportsNormalization($data, $format = NULL, array $context = [])

{@inheritdoc}

Parameters

$data
$format
array $context

supportsDenormalization($data, $type, $format = NULL, array $context = [])

{@inheritdoc}

Parameters

$data
$type
$format
array $context