PHP Трейт WoohooLabs\Yin\JsonApi\Hydrator\UpdateHydratorTrait

Показать файл Открыть проект

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

Метод Описание
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.

Защищенные методы

Метод Описание
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 )

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

doHydrateRelationship() абстрактный защищенный Метод

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
Результат mixed

getRelationshipHydrator() абстрактный защищенный Метод

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
Результат callable[]

hydrateAttributes() абстрактный защищенный Метод

abstract protected hydrateAttributes ( mixed $domainObject, array $data ) : mixed
$domainObject mixed
$data array
Результат mixed

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

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
Результат mixed

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

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
Результат mixed

hydrateIdForUpdate() защищенный Метод

protected hydrateIdForUpdate ( mixed $domainObject, array $data, WoohooLabs\Yin\JsonApi\Exception\ExceptionFactoryInterface $exceptionFactory ) : mixed
$domainObject mixed
$data array
$exceptionFactory WoohooLabs\Yin\JsonApi\Exception\ExceptionFactoryInterface
Результат mixed

hydrateRelationships() абстрактный защищенный Метод

abstract protected hydrateRelationships ( mixed $domainObject, array $data, WoohooLabs\Yin\JsonApi\Exception\ExceptionFactoryInterface $exceptionFactory ) : mixed
$domainObject mixed
$data array
$exceptionFactory WoohooLabs\Yin\JsonApi\Exception\ExceptionFactoryInterface
Результат mixed

setId() абстрактный защищенный Метод

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
Результат mixed | null

validateType() абстрактный защищенный Метод

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