PHP Интерфейс WoohooLabs\Yin\JsonApi\Transformer\ResourceTransformerInterface

Показать файл Открыть проект Примеры использования интерфейса

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

Метод Описание
getAttributes ( mixed $domainObject ) : callable[] Provides information about the "attributes" section of the current resource.
getDefaultIncludedRelationships ( mixed $domainObject ) : array Returns an array of relationship names which are included in the response by default.
getId ( mixed $domainObject ) : string Provides information about the "id" section of the current resource.
getLinks ( mixed $domainObject ) : WoohooLabs\Yin\JsonApi\Schema\Links | null Provides information about the "links" section of the current resource.
getMeta ( mixed $domainObject ) : array Provides information about the "meta" section of the current resource.
getRelationships ( mixed $domainObject ) : callable[] Provides information about the "relationships" section of the current resource.
getType ( mixed $domainObject ) : string Provides information about the "type" section of the current resource.
transformRelationship ( string $relationshipName, Transformation $transformation, mixed $domainObject, array $additionalMeta = [] ) : array
transformToResource ( Transformation $transformation, mixed $domainObject ) : array
transformToResourceIdentifier ( mixed $domainObject ) : array | null

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

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

The method returns an array where the keys signify the attribute names, while the values are callables receiving the domain object as an argument, and they should return the value of the corresponding attribute.
public getAttributes ( mixed $domainObject ) : callable[]
$domainObject mixed
Результат callable[]

getDefaultIncludedRelationships() публичный Метод

Returns an array of relationship names which are included in the response by default.
public getDefaultIncludedRelationships ( mixed $domainObject ) : array
$domainObject mixed
Результат array

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

The method returns the ID of the current resource which should be a UUID.
public getId ( mixed $domainObject ) : string
$domainObject mixed
Результат string

getMeta() публичный Метод

The method returns an array of non-standard meta information about the resource. If this array is empty, the section won't appear in the response.
public getMeta ( mixed $domainObject ) : array
$domainObject mixed
Результат array

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

The method returns an array where the keys signify the relationship names, while the values are callables receiving the domain object as an argument, and they should return a new relationship instance (to-one or to-many).
public getRelationships ( mixed $domainObject ) : callable[]
$domainObject mixed
Результат callable[]

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

The method returns the type of the current resource.
public getType ( mixed $domainObject ) : string
$domainObject mixed
Результат string

transformRelationship() публичный Метод

public transformRelationship ( string $relationshipName, Transformation $transformation, mixed $domainObject, array $additionalMeta = [] ) : array
$relationshipName string
$transformation Transformation
$domainObject mixed
$additionalMeta array
Результат array

transformToResource() публичный Метод

public transformToResource ( Transformation $transformation, mixed $domainObject ) : array
$transformation Transformation
$domainObject mixed
Результат array

transformToResourceIdentifier() публичный Метод

public transformToResourceIdentifier ( mixed $domainObject ) : array | null
$domainObject mixed
Результат array | null