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

Commit 8b49e87

Browse files
committed
Defer injection of default service configuration
- Defer until after testing the instance, to allow injection in retrieved instances (vs lazy-instantiated ones).
1 parent 0086ca6 commit 8b49e87

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/Service/ServiceListenerFactory.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ public function __invoke(ContainerInterface $container, $requestedName, array $o
148148

149149
$serviceListener = $container->has('ServiceListenerInterface')
150150
? $container->get('ServiceListenerInterface')
151-
: new ServiceListener($container, $this->defaultServiceConfig);
151+
: new ServiceListener($container);
152152

153153
if (! $serviceListener instanceof ServiceListenerInterface) {
154154
throw new ServiceNotCreatedException(
@@ -157,6 +157,8 @@ public function __invoke(ContainerInterface $container, $requestedName, array $o
157157
);
158158
}
159159

160+
$serviceListener->setDefaultServiceConfig($this->defaultServiceConfig);
161+
160162
if (isset($configuration['service_listener_options'])) {
161163
$this->injectServiceListenerOptions($configuration['service_listener_options'], $serviceListener);
162164
}

0 commit comments

Comments
 (0)