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 __construct( ReflectionParameter|ReflectionProperty $parameter, Yiisoft\Hydrator\Result $resolveResult, Yiisoft\Hydrator\DataInterface $data, Yiisoft\Hydrator\HydratorInterface|null $hydrator null ): mixed
$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 getData( ): Yiisoft\Hydrator\DataInterface
return Yiisoft\Hydrator\DataInterface

Data to be used for resolving.

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

            
getHydrator() public method

public getHydrator( ): Yiisoft\Hydrator\HydratorInterface

                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 getParameter( ): ReflectionParameter|ReflectionProperty
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 isResolved() for check the value is resolved or not.

public getResolvedValue( ): mixed
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 isResolved( ): boolean
return boolean

Whether the value for object property is resolved.

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