Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

module manager listeners order #2

Open
weierophinney opened this issue Dec 31, 2019 · 0 comments
Open

module manager listeners order #2

weierophinney opened this issue Dec 31, 2019 · 0 comments

Comments

@weierophinney
Copy link
Member

i was installed two module moduleA and moduleB

application.config.php :
'modules' => array (
				'moduleA',
				'moduleB',
		),

when i try to override a service of moduleA serviceA from moduleB serviceB , it was unsuccessful .

moduleA:

module.conf.php:
       service_manager=>[ ... 'serviceA' => 'serviceAFactory' ... ]

module.php:
      onBootstrap(){ ... $serviceManager->get('serviceA') ... }
moduleB:

module.php:
      getServiceConfig(){ return ... [ ... 'serviceA' => 'serviceBFactory' ... ] ;}

Code to reproduce the issue

because module listeners called in this order

https://framework.zend.com/manual/2.4/en/modules/zend.module-manager.module-manager.html
. . .
Zend\ModuleManager\Listener\ConfigListener
Zend\ModuleManager\Listener\InitTrigger
Zend\ModuleManager\Listener\LocatorRegistrationListener
Zend\ModuleManager\Listener\ModuleResolverListener
Zend\ModuleManager\Listener\OnBootstrapListener
Zend\ModuleManager\Listener\ServiceListener
. . .

its means moduleB can not override a service by providing moduleB->getServiceConfig()
on bootstrapEvent and have to define service in moduleB->getConfig() to be able override a service from moduleA ,before it call on bootstrap().
actually service manager configured in tow separated place that is not get same result.

Expected results

is it not better to call Zend\ModuleManager\Listener\ServiceListener after Zend\ModuleManager\Listener\ConfigListener to be usable in Bootstrap !?


Originally posted by @Baft at zendframework/zend-modulemanager#81

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

No branches or pull requests

1 participant