PHP 클래스 Tobscure\JsonApi\Resource

상속: implements Tobscure\JsonApi\ElementInterface, use trait LinksTrait, use trait MetaTrait
파일 보기 프로젝트 열기: tobscure/json-api 1 사용 예제들

보호된 프로퍼티들

프로퍼티 타입 설명
$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