vendor/php-amqplib/rabbitmq-bundle/DependencyInjection/Compiler/ServiceContainerPass.php line 16

Open in your IDE?
  1. <?php
  2. namespace OldSound\RabbitMqBundle\DependencyInjection\Compiler;
  3. use OldSound\RabbitMqBundle\Command\BaseRabbitMqCommand;
  4. use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
  5. use Symfony\Component\DependencyInjection\ContainerBuilder;
  6. use Symfony\Component\DependencyInjection\Reference;
  7. class ServiceContainerPass implements CompilerPassInterface
  8. {
  9.     public function process(ContainerBuilder $container): void
  10.     {
  11.         foreach ($container->findTaggedServiceIds('console.command') as $id => $attributes) {
  12.             $command $container->findDefinition($id);
  13.             if (is_a($command->getClass(), BaseRabbitMqCommand::class, true)) {
  14.                 $command->addMethodCall('setContainer', [new Reference('service_container')]);
  15.             }
  16.         }
  17.     }
  18. }