if (!
$container->
hasParameter($this->connectionsParameter
)) { return;
} $this->connections =
$container->
getParameter($this->connectionsParameter
);
$listenerRefs =
$this->
addTaggedServices($container);
// replace service container argument of event managers with smaller service locator
// so services can even remain private
foreach ($listenerRefs as $connection =>
$refs) { $this->
getEventManagerDef($container,
$connection) ->
replaceArgument(0, ServiceLocatorTagPass::
register($container,
$refs));
} } private function addTaggedServices(ContainerBuilder
$container): array
{ $listenerTag =
$this->tagPrefix.'.event_listener';
$subscriberTag =
$this->tagPrefix.'.event_subscriber';
$listenerRefs =
[];
$taggedServices =
$this->
findAndSortTags($subscriberTag,
$listenerTag,
$container);