PHP Class Zend\Mvc\Controller\LazyControllerAbstractFactory

To ease development, this factory may be used for controllers with type-hinted arguments that resolve to services in the application container; this allows omitting the step of writing a factory for each controller. You may use it as either an abstract factory: 'controllers' => [ 'abstract_factories' => [ LazyControllerAbstractFactory::class, ], ], Or as a factory, mapping a controller class name to it: 'controllers' => [ 'factories' => [ MyControllerWithDependencies::class => LazyControllerAbstractFactory::class, ], ], The latter approach is more explicit, and also more performant. The factory has the following constraints/features: - A parameter named $config typehinted as an array will receive the application "config" service (i.e., the merged configuration). - Parameters type-hinted against array, but not named $config will be injected with an empty array. - Scalar parameters will be resolved as null values. - If a service cannot be found for a given typehint, the factory will raise an exception detailing this. - Some services provided by Zend Framework components do not have entries based on their class name (for historical reasons); the factory contains a map of these class/interface names to the corresponding service name to allow them to resolve. $options passed to the factory are ignored in all cases, as we cannot make assumptions about which argument(s) they might replace.
Inheritance: implements Zend\ServiceManager\Factory\AbstractFactoryInterface
Mostrar archivo Open project: zendframework/zend-mvc

Protected Properties

Property Type Description
$aliases string[] Extend the class if you wish to add to the list.

Public Methods

Method Description
__invoke ( Interop\Container\ContainerInterface $container, $requestedName, array $options = null ) : Zend\Stdlib\DispatchableInterface {@inheritDoc}
canCreate ( Interop\Container\ContainerInterface $container, $requestedName ) {@inheritDoc}

Private Methods

Method Description
resolveParameter ( Interop\Container\ContainerInterface $container, string $requestedName ) : callable Resolve a parameter to a value.

Method Details

__invoke() public method

{@inheritDoc}
public __invoke ( Interop\Container\ContainerInterface $container, $requestedName, array $options = null ) : Zend\Stdlib\DispatchableInterface
$container Interop\Container\ContainerInterface
$options array
return Zend\Stdlib\DispatchableInterface

canCreate() public method

{@inheritDoc}
public canCreate ( Interop\Container\ContainerInterface $container, $requestedName )
$container Interop\Container\ContainerInterface

Property Details

$aliases protected_oe property

Extend the class if you wish to add to the list.
protected string[] $aliases
return string[]