PHP Класс Tobscure\JsonApi\Resource

Наследование: implements Tobscure\JsonApi\ElementInterface, use trait LinksTrait, use trait MetaTrait
Показать файл Открыть проект Примеры использования класса

Защищенные свойства (Protected)

Свойство Тип Описание
$data mixed
$fields array | null A list of fields to restrict to.
$includes array A list of relationships to include.
$merged Resource[] An array of Resources that should be merged into this one.
$serializer Tobscure\JsonApi\SerializerInterface

Открытые методы

Метод Описание
__construct ( mixed $data, Tobscure\JsonApi\SerializerInterface $serializer )
fields ( $fields )
getAttributes ( ) : array Get the resource attributes.
getData ( ) : mixed
getId ( ) : string Get the resource ID.
getRelationships ( ) : Relationship[] Get the resource relationships.
getRelationshipsAsArray ( ) : array Get the resource relationships as an array.
getResources ( )
getSerializer ( ) : Tobscure\JsonApi\SerializerInterface
getType ( ) : string Get the resource type.
getUnfilteredRelationships ( ) : Relationship[] Get the resource relationships without considering requested ones.
isIdentifier ( ) : boolean Check whether or not this resource is an identifier (i.e. does it have any data attached?).
merge ( Resource $resource ) : void Merge a resource into this one.
setData ( mixed $data ) : void
setSerializer ( Tobscure\JsonApi\SerializerInterface $serializer ) : void
toArray ( )
toIdentifier ( )
with ( $relationships )

Защищенные методы

Метод Описание
buildRelationships ( ) : Relationship[] Get an array of built relationships.
convertRelationshipsToArray ( array $relationships ) : array Convert the given array of Relationship objects into an array.
filterFields ( array $fields ) : array Filter the given fields array (attributes or relationships) according to the requested fieldset.
getOwnFields ( ) : array | null Get the requested fields for this resource type.
mergeAttributes ( array $attributes ) : array Merge the attributes of merged resources into an array of attributes.
mergeRelationships ( array $relationships ) : array Merge the relationships of merged resources into an array of relationships.

Описание методов

__construct() публичный метод

public __construct ( mixed $data, Tobscure\JsonApi\SerializerInterface $serializer )
$data mixed
$serializer Tobscure\JsonApi\SerializerInterface

buildRelationships() защищенный метод

Get an array of built relationships.
protected buildRelationships ( ) : Relationship[]
Результат Relationship[]

convertRelationshipsToArray() защищенный метод

Convert the given array of Relationship objects into an array.
protected convertRelationshipsToArray ( array $relationships ) : array
$relationships array
Результат array

fields() публичный метод

public fields ( $fields )

filterFields() защищенный метод

Filter the given fields array (attributes or relationships) according to the requested fieldset.
protected filterFields ( array $fields ) : array
$fields array
Результат array

getAttributes() публичный метод

Get the resource attributes.
public getAttributes ( ) : array
Результат array

getData() публичный метод

public getData ( ) : mixed
Результат mixed

getId() публичный метод

Get the resource ID.
public getId ( ) : string
Результат string

getOwnFields() защищенный метод

Get the requested fields for this resource type.
protected getOwnFields ( ) : array | null
Результат array | null

getRelationships() публичный метод

Get the resource relationships.
public getRelationships ( ) : Relationship[]
Результат Relationship[]

getRelationshipsAsArray() публичный метод

Get the resource relationships as an array.
public getRelationshipsAsArray ( ) : array
Результат array

getResources() публичный метод

public getResources ( )

getSerializer() публичный метод

public getSerializer ( ) : Tobscure\JsonApi\SerializerInterface
Результат Tobscure\JsonApi\SerializerInterface

getType() публичный метод

Get the resource type.
public getType ( ) : string
Результат string

getUnfilteredRelationships() публичный метод

Get the resource relationships without considering requested ones.
public getUnfilteredRelationships ( ) : Relationship[]
Результат Relationship[]

isIdentifier() публичный метод

Check whether or not this resource is an identifier (i.e. does it have any data attached?).
public isIdentifier ( ) : boolean
Результат boolean

merge() публичный метод

Merge a resource into this one.
public merge ( Resource $resource ) : void
$resource Resource
Результат void

mergeAttributes() защищенный метод

Merge the attributes of merged resources into an array of attributes.
protected mergeAttributes ( array $attributes ) : array
$attributes array
Результат array

mergeRelationships() защищенный метод

Merge the relationships of merged resources into an array of relationships.
protected mergeRelationships ( array $relationships ) : array
$relationships array
Результат array

setData() публичный метод

public setData ( mixed $data ) : void
$data mixed
Результат void

setSerializer() публичный метод

public setSerializer ( Tobscure\JsonApi\SerializerInterface $serializer ) : void
$serializer Tobscure\JsonApi\SerializerInterface
Результат void

toArray() публичный метод

public toArray ( )

toIdentifier() публичный метод

public toIdentifier ( )

with() публичный метод

public with ( $relationships )

Описание свойств

$data защищенное свойство

protected mixed $data
Результат mixed

$fields защищенное свойство

A list of fields to restrict to.
protected array|null $fields
Результат array | null

$includes защищенное свойство

A list of relationships to include.
protected array $includes
Результат array

$merged защищенное свойство

An array of Resources that should be merged into this one.
protected Resource[],Tobscure\JsonApi $merged
Результат Resource[]

$serializer защищенное свойство

protected SerializerInterface,Tobscure\JsonApi $serializer
Результат Tobscure\JsonApi\SerializerInterface