class JsonApiOne implements JsonApiElementInterface

Traits

Class JsonApiLinkTrait
Class JsonApiMetaTrait

Properties

$links The links array. from JsonApiLinkTrait
protected array $meta The meta data array. from JsonApiMetaTrait
protected mixed $data
protected JsonApiSerializationInterface $serializer
protected array $includes A list of relationships to include.
protected array|null $attributes A list of fields to restrict to.
protected JsonApiOne[] $merged An array of Resources that should be merged into this one.

Methods

array
getLinks()

Get the links.

$this
setLinks(array $links)

Set the links.

$this
addLink(string $key, string $value)

Add a link.

array
getMeta()

Get the meta.

$this
setMeta(array $meta)

Set the meta data array.

$this
addMeta(string $key, string $value)

Add meta data.

__construct(mixed $data, JsonApiSerializerAbstract $serializer)

No description

array
getResources()

Get the resources array.

array
toArray()

Map to a "resource object" array.

array
toIdentifier()

Map to a "resource object identifier" array.

array
getAttributes()

Get the resource attributes.

array
filterFields(array $fields)

Filter the given fields array (attributes or relationships) according to the requested fieldset.

array
getRelationshipsAsArray()

Get the resource relationships as an array.

array
convertRelationshipsToArray(array $relationships)

Convert the given array of Relationship objects into an array.

array
mergeRelationships(array $relationships)

Merge the relationships of merged resources into an array of relationships.

getRelationships()

Get the resource relationships.

array
mergeAttributes(array $attributes)

Merge the attributes of merged resources into an array of attributes.

array|null
getOwnFields()

Get the requested fields for this resource type.

buildRelationships()

Get an array of built relationships.

string
getType()

Get the resource type.

string
getId()

Get the resource ID.

getUnfilteredRelationships()

Get the resource relationships without considering requested ones.

bool
isIdentifier()

Check whether or not this resource is an identifier (i.e. does it have any data attached?).

void
merge(JsonApiOne $resource)

Merge a resource into this one.

$this
relations(string|array $relationships)

Request a relationship to be included.

$this
attributes(array|null $fields)

Request a restricted set of fields.

mixed
getData()

No description

void
setData(mixed $data)

No description

getSerializer()

No description

void
setSerializer(JsonApiSerializationInterface $serializer)

No description

array
getRelationsPath()

No description

mixed
getDenormalizedData($relationShips, $included, $name)

No description

getCreatedRelationships()

No description

Details

Get the links.

Return Value

array

Set the links.

Parameters

array $links

Return Value

$this

Add a link.

Parameters

string $key
string $value

Return Value

$this

in JsonApiMetaTrait at line 23
array getMeta()

Get the meta.

Return Value

array

in JsonApiMetaTrait at line 35
$this setMeta(array $meta)

Set the meta data array.

Parameters

array $meta

Return Value

$this

in JsonApiMetaTrait at line 49
$this addMeta(string $key, string $value)

Add meta data.

Parameters

string $key
string $value

Return Value

$this

at line 55
__construct(mixed $data, JsonApiSerializerAbstract $serializer)

Parameters

mixed $data
JsonApiSerializerAbstract $serializer

at line 67
array getResources()

Get the resources array.

Return Value

array

at line 75
array toArray()

Map to a "resource object" array.

Return Value

array

at line 116
array toIdentifier()

Map to a "resource object identifier" array.

Return Value

array

at line 136
array getAttributes()

Get the resource attributes.

Return Value

array

at line 153
protected array filterFields(array $fields)

Filter the given fields array (attributes or relationships) according to the requested fieldset.

Parameters

array $fields

Return Value

array

at line 166
array getRelationshipsAsArray()

Get the resource relationships as an array.

Return Value

array

at line 181
protected array convertRelationshipsToArray(array $relationships)

Convert the given array of Relationship objects into an array.

Parameters

array $relationships

Return Value

array

at line 196
protected array mergeRelationships(array $relationships)

Merge the relationships of merged resources into an array of relationships.

Parameters

array $relationships

Return Value

array

at line 210
JsonApiRelationship[] getRelationships()

Get the resource relationships.

Return Value

JsonApiRelationship[]

at line 223
protected array mergeAttributes(array $attributes)

Merge the attributes of merged resources into an array of attributes.

Parameters

array $attributes

Return Value

array

at line 236
protected array|null getOwnFields()

Get the requested fields for this resource type.

Return Value

array|null

at line 249
protected JsonApiRelationship[] buildRelationships()

Get an array of built relationships.

Return Value

JsonApiRelationship[]

at line 276
string getType()

Get the resource type.

Return Value

string

at line 286
string getId()

Get the resource ID.

Return Value

string

at line 299
JsonApiRelationship[] getUnfilteredRelationships()

Get the resource relationships without considering requested ones.

Return Value

JsonApiRelationship[]

at line 311
bool isIdentifier()

Check whether or not this resource is an identifier (i.e. does it have any data attached?).

Return Value

bool

at line 323
void merge(JsonApiOne $resource)

Merge a resource into this one.

Parameters

JsonApiOne $resource

Return Value

void

at line 335
$this relations(string|array $relationships)

Request a relationship to be included.

Parameters

string|array $relationships

Return Value

$this

at line 349
$this attributes(array|null $fields)

Request a restricted set of fields.

Parameters

array|null $fields

Return Value

$this

at line 359
mixed getData()

Return Value

mixed

at line 368
void setData(mixed $data)

Parameters

mixed $data

Return Value

void

at line 375
getSerializer()

at line 384
void setSerializer(JsonApiSerializationInterface $serializer)

Parameters

JsonApiSerializationInterface $serializer

Return Value

void

at line 392
array getRelationsPath()

Return Value

array

at line 403
mixed getDenormalizedData($relationShips, $included, $name)

Parameters

$relationShips
$included
$name

Return Value

mixed

at line 431
getCreatedRelationships()