JsonApiOne
class JsonApiOne implements JsonApiElementInterface
Traits
Properties
| protected array | $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
Get the resources array.
Map to a "resource object" array.
Map to a "resource object identifier" array.
Get the resource attributes.
Filter the given fields array (attributes or relationships) according to the requested fieldset.
Get the resource relationships as an array.
Convert the given array of Relationship objects into an array.
Merge the relationships of merged resources into an array of relationships.
Get the resource relationships.
Merge the attributes of merged resources into an array of attributes.
Get the requested fields for this resource type.
Get an array of built relationships.
Get the resource type.
Get the resource ID.
Get the resource relationships without considering requested ones.
Check whether or not this resource is an identifier (i.e. does it have any data attached?).
Request a relationship to be included.
Request a restricted set of fields.
No description
No description
No description
No description
No description
No description
Details
in JsonApiLinkTrait at line 23
array
getLinks()
Get the links.
in JsonApiLinkTrait at line 35
$this
setLinks(array $links)
Set the links.
in JsonApiLinkTrait at line 49
$this
addLink(string $key, string $value)
Add a link.
in JsonApiMetaTrait at line 23
array
getMeta()
Get the meta.
in JsonApiMetaTrait at line 35
$this
setMeta(array $meta)
Set the meta data array.
in JsonApiMetaTrait at line 49
$this
addMeta(string $key, string $value)
Add meta data.
at line 55
__construct(mixed $data, JsonApiSerializerAbstract $serializer)
at line 67
array
getResources()
Get the resources array.
at line 75
array
toArray()
Map to a "resource object" array.
at line 116
array
toIdentifier()
Map to a "resource object identifier" array.
at line 136
array
getAttributes()
Get the resource attributes.
at line 153
protected array
filterFields(array $fields)
Filter the given fields array (attributes or relationships) according to the requested fieldset.
at line 166
array
getRelationshipsAsArray()
Get the resource relationships as an array.
at line 181
protected array
convertRelationshipsToArray(array $relationships)
Convert the given array of Relationship objects into an array.
at line 196
protected array
mergeRelationships(array $relationships)
Merge the relationships of merged resources into an array of relationships.
at line 210
JsonApiRelationship[]
getRelationships()
Get the resource relationships.
at line 223
protected array
mergeAttributes(array $attributes)
Merge the attributes of merged resources into an array of attributes.
at line 236
protected array|null
getOwnFields()
Get the requested fields for this resource type.
at line 249
protected JsonApiRelationship[]
buildRelationships()
Get an array of built relationships.
at line 276
string
getType()
Get the resource type.
at line 286
string
getId()
Get the resource ID.
at line 299
JsonApiRelationship[]
getUnfilteredRelationships()
Get the resource relationships without considering requested ones.
at line 311
bool
isIdentifier()
Check whether or not this resource is an identifier (i.e. does it have any data attached?).
at line 323
void
merge(JsonApiOne $resource)
Merge a resource into this one.
at line 335
$this
relations(string|array $relationships)
Request a relationship to be included.
at line 349
$this
attributes(array|null $fields)
Request a restricted set of fields.