Skip to content

Commit 1f354a5

Browse files
committed
old methods was generating duplicate instance for each consumer/producer.
1 parent 0182f8e commit 1f354a5

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

DependencyInjection/Compiler/InjectEventDispatcherPass.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
66
use Symfony\Component\DependencyInjection\ContainerBuilder;
7+
use Symfony\Component\DependencyInjection\ContainerInterface;
78
use Symfony\Component\DependencyInjection\Reference;
89

910
/**
@@ -23,14 +24,15 @@ public function process(ContainerBuilder $container)
2324
if (!$container->has(self::EVENT_DISPATCHER_SERVICE_ID)) {
2425
return;
2526
}
26-
$eventDispatcherDefinition = $container->findDefinition(self::EVENT_DISPATCHER_SERVICE_ID);
2727
$taggedConsumers = $container->findTaggedServiceIds('old_sound_rabbit_mq.base_amqp');
2828

2929
foreach ($taggedConsumers as $id => $tag) {
3030
$definition = $container->getDefinition($id);
3131
$definition->addMethodCall(
3232
'setEventDispatcher',
33-
[$eventDispatcherDefinition]
33+
[
34+
new Reference(self::EVENT_DISPATCHER_SERVICE_ID, ContainerInterface::IGNORE_ON_INVALID_REFERENCE)
35+
]
3436
);
3537
}
3638

0 commit comments

Comments
 (0)