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

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

보호된 메소드들

메소드 설명
doHydrateRelationship ( mixed $domainObject, string $relationshipName, callable $hydrator, WoohooLabs\Yin\JsonApi\Exception\ExceptionFactoryInterface $exceptionFactory, array | null $relationshipData, array | null $data ) : mixed
getAcceptedType ( ) : string | array Determines which resource type or types can be accepted by the hydrator.
getArgumentTypeHintFromCallable ( callable $callable ) : string | null
getAttributeHydrator ( mixed $domainObject ) : callable[] Provides the attribute hydrators.
getRelationshipHydrator ( mixed $domainObject ) : callable[] Provides the relationship hydrators.
getRelationshipHydratorResult ( string $relationshipName, callable $hydrator, mixed $domainObject, ToOneRelationship | ToManyRelationship $relationshipObject, array | null $data, WoohooLabs\Yin\JsonApi\Exception\ExceptionFactoryInterface $exceptionFactory ) : mixed
getRelationshipType ( object | string | null $object ) : string | null
hydrateAttributes ( mixed $domainObject, array $data ) : mixed
hydrateRelationships ( mixed $domainObject, array $data, WoohooLabs\Yin\JsonApi\Exception\ExceptionFactoryInterface $exceptionFactory ) : mixed
validateType ( array $data, WoohooLabs\Yin\JsonApi\Exception\ExceptionFactoryInterface $exceptionFactory )

비공개 메소드들

메소드 설명
createRelationship ( array | null $relationship, WoohooLabs\Yin\JsonApi\Exception\ExceptionFactoryInterface $exceptionFactory ) : ToOneRelationship
isAssociativeArray ( array $array ) : boolean

메소드 상세

doHydrateRelationship() 보호된 메소드

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

getAcceptedType() 추상적인 보호된 메소드

If the hydrator can only accept one type of resources, the method should return a string. If it accepts more types, then it should return an array of strings. When such a resource is received for hydration which can't be accepted (its type doesn't match the acceptable type or types of the hydrator), a ResourceTypeUnacceptable exception will be raised.
abstract protected getAcceptedType ( ) : string | array
리턴 string | array

getArgumentTypeHintFromCallable() 보호된 메소드

protected getArgumentTypeHintFromCallable ( callable $callable ) : string | null
$callable callable
리턴 string | null

getAttributeHydrator() 추상적인 보호된 메소드

The method returns an array of attribute hydrators, where a hydrator is a key-value pair: the key is the specific attribute name which comes from the request and the value is a callable which hydrates the given attribute. These callables receive the domain object (which will be hydrated), the value of the currently processed attribute, the "data" part of the request and the name of the attribute to be hydrated 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 getAttributeHydrator ( mixed $domainObject ) : callable[]
$domainObject mixed
리턴 callable[]

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[]

getRelationshipHydratorResult() 보호된 메소드

protected getRelationshipHydratorResult ( string $relationshipName, callable $hydrator, mixed $domainObject, ToOneRelationship | ToManyRelationship $relationshipObject, array | null $data, WoohooLabs\Yin\JsonApi\Exception\ExceptionFactoryInterface $exceptionFactory ) : mixed
$relationshipName string
$hydrator callable
$domainObject mixed
$relationshipObject WoohooLabs\Yin\JsonApi\Hydrator\Relationship\ToOneRelationship | WoohooLabs\Yin\JsonApi\Hydrator\Relationship\ToManyRelationship
$data array | null
$exceptionFactory WoohooLabs\Yin\JsonApi\Exception\ExceptionFactoryInterface
리턴 mixed

getRelationshipType() 보호된 메소드

protected getRelationshipType ( object | string | null $object ) : string | null
$object object | string | null
리턴 string | null

hydrateAttributes() 보호된 메소드

protected hydrateAttributes ( mixed $domainObject, array $data ) : mixed
$domainObject mixed
$data array
리턴 mixed

hydrateRelationships() 보호된 메소드

protected hydrateRelationships ( mixed $domainObject, array $data, WoohooLabs\Yin\JsonApi\Exception\ExceptionFactoryInterface $exceptionFactory ) : mixed
$domainObject mixed
$data array
$exceptionFactory WoohooLabs\Yin\JsonApi\Exception\ExceptionFactoryInterface
리턴 mixed

validateType() 보호된 메소드

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