PHP Trait WoohooLabs\Yin\JsonApi\Hydrator\UpdateHydratorTrait

Afficher le fichier Open project: woohoolabs/yin

Méthodes publiques

Méthode Description
hydrateForRelationshipUpdate ( string $relationship, WoohooLabs\Yin\JsonApi\Request\RequestInterface $request, WoohooLabs\Yin\JsonApi\Exception\ExceptionFactoryInterface $exceptionFactory, mixed $domainObject ) : mixed
hydrateForUpdate ( WoohooLabs\Yin\JsonApi\Request\RequestInterface $request, WoohooLabs\Yin\JsonApi\Exception\ExceptionFactoryInterface $exceptionFactory, mixed $domainObject ) : mixed Hydrates the domain object from the updating request.

Méthodes protégées

Méthode Description
doHydrateRelationship ( mixed $domainObject, string $relationshipName, callable $hydrator, WoohooLabs\Yin\JsonApi\Exception\ExceptionFactoryInterface $exceptionFactory, array | null $relationshipData, array | null $data ) : mixed
getRelationshipHydrator ( mixed $domainObject ) : callable[] Provides the relationship hydrators.
hydrateAttributes ( mixed $domainObject, array $data ) : mixed
hydrateIdForUpdate ( mixed $domainObject, array $data, WoohooLabs\Yin\JsonApi\Exception\ExceptionFactoryInterface $exceptionFactory ) : mixed
hydrateRelationships ( mixed $domainObject, array $data, WoohooLabs\Yin\JsonApi\Exception\ExceptionFactoryInterface $exceptionFactory ) : mixed
setId ( mixed $domainObject, string $id ) : mixed | null Sets the given ID for the domain object.
validateType ( array $data, WoohooLabs\Yin\JsonApi\Exception\ExceptionFactoryInterface $exceptionFactory )

Method Details

doHydrateRelationship() abstract protected méthode

abstract protected doHydrateRelationship ( mixed $domainObject, string $relationshipName, callable $hydrator, WoohooLabs\Yin\JsonApi\Exception\ExceptionFactoryInterface $exceptionFactory, array | null $relationshipData, array | null $data ) : mixed
$domainObject mixed
$relationshipName string
$hydrator callable
$exceptionFactory WoohooLabs\Yin\JsonApi\Exception\ExceptionFactoryInterface
$relationshipData array | null
$data array | null
Résultat mixed

getRelationshipHydrator() abstract protected méthode

The method returns an array of relationship hydrators, where a hydrator is a key-value pair: the key is the specific relationship name which comes from the request and the value is an callable which hydrate the previous relationship. These callables receive the domain object (which will be hydrated), an object representing the currently processed relationship (it can be a ToOneRelationship or a ToManyRelationship object), the "data" part of the request and the relationship name as their arguments, and they should mutate the state of the domain object. If it is an immutable object or an array (and passing by reference isn't used), the callable should return the domain object.
abstract protected getRelationshipHydrator ( mixed $domainObject ) : callable[]
$domainObject mixed
Résultat callable[]

hydrateAttributes() abstract protected méthode

abstract protected hydrateAttributes ( mixed $domainObject, array $data ) : mixed
$domainObject mixed
$data array
Résultat mixed

hydrateForRelationshipUpdate() public méthode

public hydrateForRelationshipUpdate ( string $relationship, WoohooLabs\Yin\JsonApi\Request\RequestInterface $request, WoohooLabs\Yin\JsonApi\Exception\ExceptionFactoryInterface $exceptionFactory, mixed $domainObject ) : mixed
$relationship string
$request WoohooLabs\Yin\JsonApi\Request\RequestInterface
$exceptionFactory WoohooLabs\Yin\JsonApi\Exception\ExceptionFactoryInterface
$domainObject mixed
Résultat mixed

hydrateForUpdate() public méthode

The domain object's attributes and relationships are hydrated according to the JSON API specification.
public hydrateForUpdate ( WoohooLabs\Yin\JsonApi\Request\RequestInterface $request, WoohooLabs\Yin\JsonApi\Exception\ExceptionFactoryInterface $exceptionFactory, mixed $domainObject ) : mixed
$request WoohooLabs\Yin\JsonApi\Request\RequestInterface
$exceptionFactory WoohooLabs\Yin\JsonApi\Exception\ExceptionFactoryInterface
$domainObject mixed
Résultat mixed

hydrateIdForUpdate() protected méthode

protected hydrateIdForUpdate ( mixed $domainObject, array $data, WoohooLabs\Yin\JsonApi\Exception\ExceptionFactoryInterface $exceptionFactory ) : mixed
$domainObject mixed
$data array
$exceptionFactory WoohooLabs\Yin\JsonApi\Exception\ExceptionFactoryInterface
Résultat mixed

hydrateRelationships() abstract protected méthode

abstract protected hydrateRelationships ( mixed $domainObject, array $data, WoohooLabs\Yin\JsonApi\Exception\ExceptionFactoryInterface $exceptionFactory ) : mixed
$domainObject mixed
$data array
$exceptionFactory WoohooLabs\Yin\JsonApi\Exception\ExceptionFactoryInterface
Résultat mixed

setId() abstract protected méthode

The method mutates the domain object and sets the given ID for it. If it is an immutable object or an array the whole, updated domain object can be returned.
abstract protected setId ( mixed $domainObject, string $id ) : mixed | null
$domainObject mixed
$id string
Résultat mixed | null

validateType() abstract protected méthode

abstract protected validateType ( array $data, WoohooLabs\Yin\JsonApi\Exception\ExceptionFactoryInterface $exceptionFactory )
$data array
$exceptionFactory WoohooLabs\Yin\JsonApi\Exception\ExceptionFactoryInterface