0 follower

Final Class Yiisoft\Hydrator\ObjectFactory\ContainerObjectFactory

InheritanceYiisoft\Hydrator\ObjectFactory\ContainerObjectFactory
ImplementsYiisoft\Hydrator\ObjectFactory\ObjectFactoryInterface

A factory for objects that are instantiable by a container.

Method Details

Hide inherited methods

__construct() public method

public mixed __construct ( \Yiisoft\Injector\Injector $injector )
$injector \Yiisoft\Injector\Injector

                public function __construct(
    private Injector $injector,
) {
}

            
create() public method

public object create ( ReflectionClass $reflectionClass, array $constructorArguments )
$reflectionClass ReflectionClass
$constructorArguments array
throws \Psr\Container\ContainerExceptionInterface
throws ReflectionException

                public function create(ReflectionClass $reflectionClass, array $constructorArguments): object
{
    $class = $reflectionClass->getName();
    return $this->injector->make($class, $constructorArguments);
}