PHP 트레잇 WoohooLabs\Yin\JsonApi\Hydrator\UpdateHydratorTrait

파일 보기 프로젝트 열기: woohoolabs/yin

공개 메소드들

메소드 설명
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