0 follower

Final Class Yiisoft\Hydrator\AttributeHandling\ParameterAttributeResolveContext

InheritanceYiisoft\Hydrator\AttributeHandling\ParameterAttributeResolveContext

Holds attribute resolving context data.

Method Details

Hide inherited methods

__construct() public method

public mixed __construct ( ReflectionParameter|ReflectionProperty $parameter, Yiisoft\Hydrator\Result $resolveResult, Yiisoft\Hydrator\DataInterface $data, Yiisoft\Hydrator\HydratorInterface|null $hydrator null )
$parameter ReflectionParameter|ReflectionProperty

Resolved parameter or property reflection.

$resolveResult Yiisoft\Hydrator\Result

The resolved value object.

$data Yiisoft\Hydrator\DataInterface

Data to be used for resolving.

$hydrator Yiisoft\Hydrator\HydratorInterface|null

                public function __construct(
    private ReflectionParameter|ReflectionProperty $parameter,
    private Result $resolveResult,
    private DataInterface $data,
    private ?HydratorInterface $hydrator = null,
) {
}

            
getData() public method

public Yiisoft\Hydrator\DataInterface getData ( )
return Yiisoft\Hydrator\DataInterface

Data to be used for resolving.

                public function getData(): DataInterface
{
    return $this->data;
}

            
getHydrator() public method

public Yiisoft\Hydrator\HydratorInterface getHydrator ( )

                public function getHydrator(): HydratorInterface
{
    if ($this->hydrator === null) {
        throw new LogicException('Hydrator is not set in parameter attribute resolve context.');
    }
    return $this->hydrator;
}

            
getParameter() public method

Get resolved parameter or property reflection.

public ReflectionParameter|ReflectionProperty getParameter ( )
return ReflectionParameter|ReflectionProperty

Resolved parameter or property reflection.

                public function getParameter(): ReflectionParameter|ReflectionProperty
{
    return $this->parameter;
}

            
getResolvedValue() public method

Get the resolved value.

When value is not resolved returns null. But null can be is resolved value, use {@see \Yiisoft\Hydrator\AttributeHandling\isResolved()} for check the value is resolved or not.

public mixed getResolvedValue ( )
return mixed

The resolved value.

                public function getResolvedValue(): mixed
{
    return $this->resolveResult->getValue();
}

            
isResolved() public method

Get whether the value for object property is resolved already.

public boolean isResolved ( )
return boolean

Whether the value for object property is resolved.

                public function isResolved(): bool
{
    return $this->resolveResult->isResolved();
}