PHP Class Tobscure\JsonApi\Collection

Inheritance: implements Tobscure\JsonApi\ElementInterface
Datei anzeigen Open project: tobscure/json-api Class Usage Examples

Protected Properties

Property Type Description
$resources array

Public Methods

Method Description
__construct ( mixed $data, Tobscure\JsonApi\SerializerInterface $serializer ) Create a new collection instance.
fields ( array | null $fields ) Request a restricted set of fields.
getResources ( )
identify ( string | array $relationships ) Request a relationship to be identified for all resources.
setResources ( array $resources ) : void Set the resources array.
toArray ( )
toIdentifier ( )
with ( string | array $relationships ) Request a relationship to be included for all resources.

Protected Methods

Method Description
buildResources ( mixed $data, Tobscure\JsonApi\SerializerInterface $serializer ) : Resource[] Convert an array of raw data to Resource objects.

Method Details

__construct() public method

Create a new collection instance.
public __construct ( mixed $data, Tobscure\JsonApi\SerializerInterface $serializer )
$data mixed
$serializer Tobscure\JsonApi\SerializerInterface

buildResources() protected method

Convert an array of raw data to Resource objects.
protected buildResources ( mixed $data, Tobscure\JsonApi\SerializerInterface $serializer ) : Resource[]
$data mixed
$serializer Tobscure\JsonApi\SerializerInterface
return Resource[]

fields() public method

Request a restricted set of fields.
public fields ( array | null $fields )
$fields array | null

getResources() public method

public getResources ( )

identify() public method

Request a relationship to be identified for all resources.
public identify ( string | array $relationships )
$relationships string | array

setResources() public method

Set the resources array.
public setResources ( array $resources ) : void
$resources array
return void

toArray() public method

public toArray ( )

toIdentifier() public method

public toIdentifier ( )

with() public method

Request a relationship to be included for all resources.
public with ( string | array $relationships )
$relationships string | array

Property Details

$resources protected_oe property

protected array $resources
return array