| Fully Qualified Name: | Zend\ServiceManager\AbstractFactory\ReflectionBasedAbstractFactory |
| Implements: | AbstractFactoryInterface |
Reflection-based factory.
To ease development, this factory may be used for classes 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:
'service_manager' => [
'abstract_factories' => [
ReflectionBasedAbstractFactory::class,
],
],
Or as a factory, mapping a class name to it:
'service_manager' => [
'factories' => [
MyClassWithDependencies::class => ReflectionBasedAbstractFactory::class,
],
],
The latter approach is more explicit, and also more performant.
The factory has the following constraints/features:
$config typehinted as an array will receive the
application "config" service (i.e., the merged configuration).$config will
be injected with an empty array.$options passed to the factory are ignored in all cases, as we cannot
make assumptions about which argument(s) they might replace.
Based on the LazyControllerAbstractFactory from zend-mvc.
| Name | Description | Defined By |
|---|---|---|
| __construct() | Constructor. | ReflectionBasedAbstractFactory |
| __invoke() | {@inheritDoc} | ReflectionBasedAbstractFactory |
| canCreate() | {@inheritDoc} | ReflectionBasedAbstractFactory |
Constructor.
Allows overriding the internal list of aliases. These should be of the
form class name => well-known service name; see the documentation for
the $aliases property for details on what is accepted.
| Parameter Name | Type | Description |
|---|---|---|
| $aliases | string[] |
Returns:
{@inheritDoc}
| Parameter Name | Type | Description |
|---|---|---|
| $container | ||
| $requestedName | ||
| $options |
Returns: \DispatchableInterface
{@inheritDoc}
| Parameter Name | Type | Description |
|---|---|---|
| $container | ||
| $requestedName |
Returns: