Skip to content
This repository was archived by the owner on Jan 29, 2020. It is now read-only.

Commit 7a26cce

Browse files
committed
Restore v2 workflow, but updated for v2/v3 zend-servicemanager compatibility
Removed previous workflow from v2 with regards to: - instantiation and initial configuration of the SM - Retrieving the SM from the ServiceListener post-module loading (no longer necessary)
1 parent db96746 commit 7a26cce

File tree

1 file changed

+4
-11
lines changed

1 file changed

+4
-11
lines changed

src/Application.php

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -146,8 +146,8 @@ public function getConfig()
146146
*/
147147
public function bootstrap(array $listeners = [])
148148
{
149-
$events = $this->events;
150149
$serviceManager = $this->serviceManager;
150+
$events = $this->events;
151151

152152
// Setup default listeners
153153
$listeners = array_unique(array_merge($this->defaultListeners, $listeners));
@@ -264,20 +264,13 @@ public static function init($configuration = [])
264264
$smConfig = isset($configuration['service_manager']) ? $configuration['service_manager'] : [];
265265
$smConfig = new Service\ServiceManagerConfig($smConfig);
266266

267-
$serviceManager = new ServiceManager($smConfig->toArray());
268-
$serviceManager = $serviceManager->withConfig(['services' => [
269-
'ApplicationConfig' => $configuration,
270-
]]);
267+
$serviceManager = new ServiceManager();
268+
$smConfig->configureServiceManager($serviceManager);
269+
$serviceManager->setService('ApplicationConfig', $configuration);
271270

272271
// Load modules
273272
$serviceManager->get('ModuleManager')->loadModules();
274273

275-
// Get the configured SM if necessary.
276-
if ($serviceManager->has('ServiceListener')) {
277-
$serviceListener = $serviceManager->get('ServiceListener');
278-
$serviceManager = $serviceListener->getConfiguredServiceManager();
279-
}
280-
281274
// Prepare list of listeners to bootstrap
282275
$listenersFromAppConfig = isset($configuration['listeners']) ? $configuration['listeners'] : [];
283276
$config = $serviceManager->get('config');

0 commit comments

Comments
 (0)