findAndSortTags example

        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);

        $managerDefs = [];
        foreach ($taggedServices as $taggedSubscriber) {
            [$tagName$id$tag] = $taggedSubscriber;
            $connections = isset($tag['connection'])
                ? [$container->getParameterBag()->resolveValue($tag['connection'])]
                : array_keys($this->connections);
            if ($listenerTag === $tagName && !isset($tag['event'])) {
                throw new InvalidArgumentException(sprintf('Doctrine event listener "%s" must specify the "event" attribute.', $id));
            }
            foreach ($connections as $con) {
                
Home | Imprint | This part of the site doesn't use cookies.