-
-
Notifications
You must be signed in to change notification settings - Fork 23
Description
I think the documentation is wrong:
https://docs.zendframework.com/zend-di/cookbook/aot-guide/#5-add-aot-to-the-service-manager
In getDependencies method of ConfigProvider we have:
'factories' => $this->getGeneratedFactories(),
'delegators' => [
InjectorInterface::class => [
InjectorDecoratorFactory::class,
],
],but I think one of this configuration is useless.
If we inject generated factories in factories key then we don't need to use decorator (which uses GeneratedInjector and in fact is an abstract factory - but uses only generated factories list).
But in case we have factories injected already into service manager the abstract factory for the service is not going to be called as the factory is defined. If the factory is not defined (so for example service was added later and factories were not regenerated) then normal injector is going to be used anyway (generated injector is just the proxy to origin injector in case factory is not defined).
Of course it doesn't change too much, but in case we need use injector (abstract factory) we don't need to check again on generated list, as this is not there.
Originally posted by @michalbundyra at zendframework/zend-di#53