PHP Class WoohooLabs\Yin\JsonApi\Transformer\AbstractResourceTransformer

Inheritance: implements WoohooLabs\Yin\JsonApi\Transformer\ResourceTransformerInterface, use trait WoohooLabs\Yin\TransformerTrait
显示文件 Open project: woohoolabs/yin

Public Methods

Method Description
transformRelationship ( string $relationshipName, Transformation $transformation, mixed $domainObject, array $additionalMeta = [] ) : array | null Transforms a relationship with a name of $relationshipName of the original resource to a JSON API relationship.
transformToResource ( Transformation $transformation, mixed $domainObject ) : array Transforms the original resource to a JSON API resource.
transformToResourceIdentifier ( mixed $domainObject ) : array | null Transforms the original resource to a JSON API resource identifier.

Protected Methods

Method Description
transformAttributes ( Transformation $transformation, array $attributes, mixed $domainObject ) : array
transformAttributesObject ( array &$array, Transformation $transformation, mixed $domainObject )
transformLinksObject ( array &$array, mixed $domainObject )
transformRelationshipObject ( Transformation $transformation, mixed $domainObject, string $relationshipName, array $relationships, array $defaultRelationships, array $additionalMeta = [] ) : array | null
transformRelationships ( Transformation $transformation, mixed $domainObject, array $relationships ) : array
transformRelationshipsObject ( array &$array, Transformation $transformation, mixed $domainObject )
validateRelationships ( Transformation $transformation, array $relationships )

Method Details

transformAttributes() protected method

protected transformAttributes ( Transformation $transformation, array $attributes, mixed $domainObject ) : array
$transformation Transformation
$attributes array
$domainObject mixed
return array

transformAttributesObject() protected method

protected transformAttributesObject ( array &$array, Transformation $transformation, mixed $domainObject )
$array array
$transformation Transformation
$domainObject mixed

transformLinksObject() protected method

protected transformLinksObject ( array &$array, mixed $domainObject )
$array array
$domainObject mixed

transformRelationship() public method

Transforms a relationship with a name of $relationshipName of the original resource to a JSON API relationship.
public transformRelationship ( string $relationshipName, Transformation $transformation, mixed $domainObject, array $additionalMeta = [] ) : array | null
$relationshipName string
$transformation Transformation
$domainObject mixed
$additionalMeta array
return array | null

transformRelationshipObject() protected method

protected transformRelationshipObject ( Transformation $transformation, mixed $domainObject, string $relationshipName, array $relationships, array $defaultRelationships, array $additionalMeta = [] ) : array | null
$transformation Transformation
$domainObject mixed
$relationshipName string
$relationships array
$defaultRelationships array
$additionalMeta array
return array | null

transformRelationships() protected method

protected transformRelationships ( Transformation $transformation, mixed $domainObject, array $relationships ) : array
$transformation Transformation
$domainObject mixed
$relationships array
return array

transformRelationshipsObject() protected method

protected transformRelationshipsObject ( array &$array, Transformation $transformation, mixed $domainObject )
$array array
$transformation Transformation
$domainObject mixed

transformToResource() public method

Transforms the original resource to a JSON API resource.
public transformToResource ( Transformation $transformation, mixed $domainObject ) : array
$transformation Transformation
$domainObject mixed
return array

transformToResourceIdentifier() public method

Transforms the original resource to a JSON API resource identifier.
public transformToResourceIdentifier ( mixed $domainObject ) : array | null
$domainObject mixed
return array | null

validateRelationships() protected method

protected validateRelationships ( Transformation $transformation, array $relationships )
$transformation Transformation
$relationships array