class RegisterSerializationClassesCompilerPass extends RegisterSerializationClassesCompilerPass (View source)

internal  JSON:API maintains no PHP API. The API is the HTTP API. This class may change at any time and could break any dependencies on it.
 

Adds services tagged JSON:API-only normalizers to the Serializer.

Services tagged with 'jsonapi_normalizer' will be added to the JSON:API serializer. No extensions can provide such services.

JSON:API does respect generic (non-JSON:API) DataType-level normalizers.

Constants

OVERRIDDEN_SERVICE_ID

The service ID.

OVERRIDDEN_SERVICE_NORMALIZER_TAG

The service tag that only JSON:API normalizers should use.

OVERRIDDEN_SERVICE_ENCODER_TAG

The service tag that only JSON:API encoders should use.

FORMAT

The ID for the JSON:API format.

Methods

process(ContainerBuilder $container)

Adds services to the JSON:API Serializer.

array
sort(array $services)

Sorts by priority.

Details

process(ContainerBuilder $container)

Adds services to the JSON:API Serializer.

This code is copied from the class parent with two modifications. The service id has been changed and the service tag has been updated.

ID: 'serializer' -> 'jsonapi.serializer' Tag: 'normalizer' -> 'jsonapi_normalizer'

Parameters

ContainerBuilder $container

The container to process.

protected array sort(array $services)

Sorts by priority.

Order services from highest priority number to lowest (reverse sorting).

Parameters

array $services

A nested array keyed on priority number. For each priority number, the value is an array of Symfony\Component\DependencyInjection\Reference objects, each a reference to a normalizer or encoder service.

Return Value

array

A flattened array of Reference objects from $services, ordered from high to low priority.