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 __construct( \Yiisoft\Injector\Injector $injector ): mixed
$injector \Yiisoft\Injector\Injector

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

            
create() public method

public create( ReflectionClass $reflectionClass, array $constructorArguments ): object
$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);
}