Removing service initializer as of zendframework/zf2#3537 #3545

Merged
merged 1 commit into from Jan 25, 2013

3 participants

@Ocramius
Zend Framework member

Fix for #3537

This PR removes Di service initialization from the default initializers when $sm->get('Config')['di'] is set in an MVC application.

@Ocramius Ocramius commented on the diff Jan 23, 2013
library/Zend/Mvc/Service/DiServiceInitializerFactory.php
@@ -24,13 +24,6 @@ class DiServiceInitializerFactory implements FactoryInterface
*/
public function createService(ServiceLocatorInterface $serviceLocator)
{
- $initializer = new DiServiceInitializer($serviceLocator->get('Di'), $serviceLocator);
-
- if ($serviceLocator instanceof ServiceManager) {
- /* @var $serviceLocator ServiceManager */
- $serviceLocator->addInitializer($initializer);
@Ocramius
Zend Framework member
Ocramius added a line comment Jan 23, 2013

This black magic had to go. Too much responsibility for a factory.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@prolic

Question about this one:
As the DiServiceInitializer is removed, how should I add it, when I want this behaviour?

@Ocramius
Zend Framework member

@prolic I didn't remove the factories that produce the initializer. You can still $sm->addInitializer($sm->get('Zend\Mvc\Service\DiServiceInitializer')) at any point in time

@weierophinney
Zend Framework member

@ocramius When I tried to pull just now, git said it couldn't find the branch. Did you delete it?

@weierophinney
Zend Framework member

@ocramius Never mind. PEBKAC.

@weierophinney weierophinney added a commit that referenced this pull request Jan 25, 2013
@weierophinney weierophinney Merge branch 'hotfix/3545' into develop
Close #3545
Fixes #3537
266342e
@weierophinney weierophinney merged commit c62a95a into zendframework:develop Jan 25, 2013

1 check failed

Details default The Travis build failed
@ghost Unknown pushed a commit that referenced this pull request Jul 14, 2013
@weierophinney weierophinney Merge branch 'hotfix/3545' into develop
Close #3545
Fixes #3537
dddb9f8
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment