-
Notifications
You must be signed in to change notification settings - Fork 470
/
OldSoundRabbitMqBundle.php
38 lines (33 loc) · 1.22 KB
/
OldSoundRabbitMqBundle.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
<?php
namespace OldSound\RabbitMqBundle;
use OldSound\RabbitMqBundle\DependencyInjection\Compiler\InjectEventDispatcherPass;
use OldSound\RabbitMqBundle\DependencyInjection\Compiler\RegisterPartsPass;
use OldSound\RabbitMqBundle\DependencyInjection\Compiler\ServiceContainerPass;
use Symfony\Component\HttpKernel\Bundle\Bundle;
use Symfony\Component\DependencyInjection\ContainerBuilder;
class OldSoundRabbitMqBundle extends Bundle
{
public function build(ContainerBuilder $container): void
{
parent::build($container);
$container->addCompilerPass(new RegisterPartsPass());
$container->addCompilerPass(new InjectEventDispatcherPass());
$container->addCompilerPass(new ServiceContainerPass());
}
/**
* {@inheritDoc}
*/
public function shutdown(): void
{
parent::shutdown();
if (!$this->container->hasParameter('old_sound_rabbit_mq.base_amqp')) {
return;
}
$connections = $this->container->getParameter('old_sound_rabbit_mq.base_amqp');
foreach ($connections as $connection) {
if ($this->container->initialized($connection)) {
$this->container->get($connection)->close();
}
}
}
}