maybe I'm the only one, but I'd like to get some ideas from your side
about the service manager integartion for Zend\Di.
At the moment, when I use
$serviceManager->get('di')->newInstance('some\Class'), it will
completely ignore the services I configured in the service manager. It
would be very useful if it would respect the configured services.
In the service manager, there is a service called "Zend\Db\Adapter\Adapter".
In the DI config there is a type preference for
Zend\Db\Adapter\AdapterInterface to Zend\Db\Adapter\Adapter.
When I fetch an instance via the absract di service factory tha adapter
from the service manager, the service is injected. When i need to fetch
a new instance explicitly via newInstance() it is ignored.
For my projects I created a custom Di\InstanceManager which will check
the service manager first (excluding abstract factories). This saves me
from creating a lot of weired (and imho unneccessary) factories and
$serviceManager->get('di')->newInstance('some\Class'); is always aware
of the configured services.
Is there anyone who would appreciate this behavior in ZF2 mvc as well?