Class LazyControllerAbstractFactory

Summary

Fully Qualified Name: Zend\Mvc\Controller\LazyControllerAbstractFactory
Implements: AbstractFactoryInterface

Description

Reflection-based factory for controllers.

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:

$options passed to the factory are ignored in all cases, as we cannot make assumptions about which argument(s) they might replace.

Methods

Name Description Defined By
__invoke() {@inheritDoc} LazyControllerAbstractFactory
canCreate() {@inheritDoc} LazyControllerAbstractFactory

Method Details

__invoke()

{@inheritDoc}

Parameter Name Type Description
$container
$requestedName
$options

Returns: \DispatchableInterface

canCreate()

{@inheritDoc}

Parameter Name Type Description
$container
$requestedName

Returns:

Top