class JsonApiDocumentTopLevel (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.
 

Represents a JSON:API document's "top level".

Add support for the missing optional 'jsonapi' member or document why not.

Properties

protected ResourceIdentifierInterface|Data|ErrorCollection|EntityReferenceFieldItemListInterface $data

The data to normalize.

protected array $meta

The metadata to normalize.

$links

The links.

protected IncludedData $includes

The includes to normalize.

protected OmittedData $omissions

Resource objects that will be omitted from the response for access reasons.

Methods

__construct(TopLevelDataInterface|ErrorCollection $data, IncludedData $includes, LinkCollection $links, array $meta = [])

Instantiates a JsonApiDocumentTopLevel object.

getData()

Gets the data.

getLinks()

Gets the links.

array
getMeta()

Gets the metadata.

getIncludes()

Gets a JSON:API Data object of resources to be included in the response.

getOmissions()

Gets an OmittedData instance containing resources to be omitted.

Details

__construct(TopLevelDataInterface|ErrorCollection $data, IncludedData $includes, LinkCollection $links, array $meta = [])

Instantiates a JsonApiDocumentTopLevel object.

Parameters

TopLevelDataInterface|ErrorCollection $data

The data to normalize. It can be either a ResourceObject, or a stand-in for one, or a collection of the same.

IncludedData $includes

A JSON:API Data object containing resources to be included in the response document or NULL if there should not be includes.

LinkCollection $links

A collection of links to resources related to the top-level document.

array $meta

(optional) The metadata to normalize.

Data|ErrorCollection getData()

Gets the data.

Return Value

Data|ErrorCollection

The data.

Gets the links.

Return Value

LinkCollection

The top-level links.

array getMeta()

Gets the metadata.

Return Value

array

The metadata.

IncludedData getIncludes()

Gets a JSON:API Data object of resources to be included in the response.

Return Value

IncludedData

The includes.

OmittedData getOmissions()

Gets an OmittedData instance containing resources to be omitted.

Return Value

OmittedData

The omissions.