Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Ensure DiAbstractServiceFactory takes lowest possible priority #5180

Closed
wants to merge 1 commit into from

3 participants

@grncdr

I'm far from expert on all the intricacies of Zend\Di, but this
seemed necessary for my application.

AFAICT, the Zend\ServiceManager\Di\DiAbstractServiceFactory
will be lazily added to the shared ServiceManager at an unpredictable
time. The default behaviour of addAbstractFactory puts this new
abstract factory in front of abstract factories from modules, which leads
to the DiAbstractFactory trying to create things before module-defined
abstract factories get a chance.

@grncdr grncdr Ensure DiAbstractServiceFactory takes lowest possible priority
A `Zend\Di` abstract factory should always be checked *after*
abstract factories from modules.
cf6256e
@grncdr

The Travis failure above looks unrelated: https://travis-ci.org/zendframework/zf2/jobs/11851852#L183

@Ocramius
Collaborator

:+1: to this

@grncdr

Who do I need to @ reply on this to get it merged?

@Ocramius
Collaborator

@grncdr you need to wait for someone of the CR team. If you rely on it, then please use your fork for now.

@weierophinney

Can you add tests for this -- essentially, show adding other abstract factories around adding this will result in DI being the last called? I worry we'll miss this in a future changeset.

@weierophinney

Actually, belay that last comment. Merging.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Sep 27, 2013
  1. @grncdr

    Ensure DiAbstractServiceFactory takes lowest possible priority

    grncdr authored
    A `Zend\Di` abstract factory should always be checked *after*
    abstract factories from modules.
This page is out of date. Refresh to see the latest.
Showing with 1 addition and 1 deletion.
  1. +1 −1  library/Zend/Mvc/Service/DiAbstractServiceFactoryFactory.php
View
2  library/Zend/Mvc/Service/DiAbstractServiceFactoryFactory.php
@@ -28,7 +28,7 @@ public function createService(ServiceLocatorInterface $serviceLocator)
if ($serviceLocator instanceof ServiceManager) {
/* @var $serviceLocator ServiceManager */
- $serviceLocator->addAbstractFactory($factory);
+ $serviceLocator->addAbstractFactory($factory, false);
}
return $factory;
Something went wrong with that request. Please try again.