Skip to content
This repository has been archived by the owner on Feb 6, 2020. It is now read-only.

LazyServiceFactory class_exists feature #185

Open
tommyseus opened this issue Mar 17, 2017 · 2 comments
Open

LazyServiceFactory class_exists feature #185

tommyseus opened this issue Mar 17, 2017 · 2 comments

Comments

@tommyseus
Copy link

Hello, in the lazy_services configuration is a class_map array.
That array looks for most of my services like this:

[
    Foo::class => Foo::class,
    Bar::class => Bar::class,
]

For one Service i need a factories entry, a delegators entry and a class_map entry to the service_manager configuration.
Is it possible to add a class_exists option as "feature" to the LazyServiceFactory?

if (isset($this->servicesMap[$name])) {
    return $this->proxyFactory->createProxy($this->servicesMap[$name], $initializer);
} elseif ($this->useClassExists && class_exists($name)) {
    return $this->proxyFactory->createProxy($name, $initializer);
}
@Ocramius
Copy link
Member

To be honest, this could easily be the default settings, but the service manager provides no type guarantees, so it is quite risky to apply. Could you check if we could add return type hints to the lazy loafing proxy initializers?

@weierophinney
Copy link
Member

This repository has been closed and moved to laminas/laminas-servicemanager; a new issue has been opened at laminas/laminas-servicemanager#17.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants