PHP Класс 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.
Показать файл
Открыть проект
Защищенные свойства (Protected)
Свойство |
Тип |
Описание |
|
$aliases |
string[] |
Extend the class if you wish to add to the list. |
|
Открытые методы
Метод |
Описание |
|
__invoke ( Interop\Container\ContainerInterface $container, $requestedName, array $options = null ) : Zend\Stdlib\DispatchableInterface |
{@inheritDoc} |
|
canCreate ( Interop\Container\ContainerInterface $container, $requestedName ) |
{@inheritDoc} |
|
Приватные методы
Описание методов
__invoke()
публичный Метод
public __invoke ( Interop\Container\ContainerInterface $container, $requestedName, array $options = null ) : Zend\Stdlib\DispatchableInterface |
$container |
Interop\Container\ContainerInterface |
|
$options |
array |
|
Результат |
Zend\Stdlib\DispatchableInterface |
|
canCreate()
публичный Метод
public canCreate ( Interop\Container\ContainerInterface $container, $requestedName ) |
$container |
Interop\Container\ContainerInterface |
|
Описание свойств
$aliases защищенное свойство
Extend the class if you wish to add to the list.
protected string[] $aliases |
Результат |
string[] |
|