PHP Interface WoohooLabs\Yin\JsonApi\Transformer\ResourceTransformerInterface

Afficher le fichier Open project: woohoolabs/yin Interface Usage Examples

Méthodes publiques

Méthode Description
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

Method Details

getAttributes() public méthode

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
Résultat callable[]

getDefaultIncludedRelationships() public méthode

Returns an array of relationship names which are included in the response by default.
public getDefaultIncludedRelationships ( mixed $domainObject ) : array
$domainObject mixed
Résultat array

getId() public méthode

The method returns the ID of the current resource which should be a UUID.
public getId ( mixed $domainObject ) : string
$domainObject mixed
Résultat string

getMeta() public méthode

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
Résultat array

getRelationships() public méthode

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
Résultat callable[]

getType() public méthode

The method returns the type of the current resource.
public getType ( mixed $domainObject ) : string
$domainObject mixed
Résultat string

transformRelationship() public méthode

public transformRelationship ( string $relationshipName, Transformation $transformation, mixed $domainObject, array $additionalMeta = [] ) : array
$relationshipName string
$transformation Transformation
$domainObject mixed
$additionalMeta array
Résultat array

transformToResource() public méthode

public transformToResource ( Transformation $transformation, mixed $domainObject ) : array
$transformation Transformation
$domainObject mixed
Résultat array

transformToResourceIdentifier() public méthode

public transformToResourceIdentifier ( mixed $domainObject ) : array | null
$domainObject mixed
Résultat array | null