Skip to content

Commit 68e48b0

Browse files
committed
minor #17398 [DependencyInjection] Show how to get $myService (tacman)
This PR was submitted for the 6.1 branch but it was squashed and merged into the 4.4 branch instead. Discussion ---------- [DependencyInjection] Show how to get $myService Fixes #17397, makes it clearer how to get the service, since ->get() isn't correct and getDefinition() isn't obvious. Commits ------- 95b8fea [DependencyInjection] Show how to get $myService
2 parents b688f71 + 95b8fea commit 68e48b0

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

service_container/service_subscribers_locators.rst

+2
Original file line numberDiff line numberDiff line change
@@ -467,6 +467,8 @@ will share identical locators among all the services referencing them::
467467
// ...
468468
'logger' => new Reference('logger'),
469469
];
470+
471+
$myService = $container->findDefinition(MyService::class);
470472

471473
$myService->addArgument(ServiceLocatorTagPass::register($container, $locateableServices));
472474
}

0 commit comments

Comments
 (0)