vendor/php-amqplib/rabbitmq-bundle/OldSoundRabbitMqBundle.php line 11

Open in your IDE?
  1. <?php
  2. namespace OldSound\RabbitMqBundle;
  3. use OldSound\RabbitMqBundle\DependencyInjection\Compiler\InjectEventDispatcherPass;
  4. use OldSound\RabbitMqBundle\DependencyInjection\Compiler\RegisterPartsPass;
  5. use OldSound\RabbitMqBundle\DependencyInjection\Compiler\ServiceContainerPass;
  6. use Symfony\Component\HttpKernel\Bundle\Bundle;
  7. use Symfony\Component\DependencyInjection\ContainerBuilder;
  8. class OldSoundRabbitMqBundle extends Bundle
  9. {
  10. public function build(ContainerBuilder $container): void
  11. {
  12. parent::build($container);
  13. $container->addCompilerPass(new RegisterPartsPass());
  14. $container->addCompilerPass(new InjectEventDispatcherPass());
  15. $container->addCompilerPass(new ServiceContainerPass());
  16. }
  17. /**
  18. * {@inheritDoc}
  19. */
  20. public function shutdown(): void
  21. {
  22. parent::shutdown();
  23. if (!$this->container->hasParameter('old_sound_rabbit_mq.base_amqp')) {
  24. return;
  25. }
  26. $connections = $this->container->getParameter('old_sound_rabbit_mq.base_amqp');
  27. foreach ($connections as $connection) {
  28. if ($this->container->initialized($connection)) {
  29. $this->container->get($connection)->close();
  30. }
  31. }
  32. }
  33. }