-
Notifications
You must be signed in to change notification settings - Fork 1
/
PhpDDDDomainDrivenDesignBundle.php
51 lines (46 loc) · 1.46 KB
/
PhpDDDDomainDrivenDesignBundle.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
39
40
41
42
43
44
45
46
47
48
49
50
51
<?php
namespace PhpDDD\DomainDrivenDesignBundle;
use PhpDDD\DomainDrivenDesignBundle\DependencyInjection\Compiler\DispatcherCompilerPass;
use PhpDDD\DomainDrivenDesignBundle\DependencyInjection\DomainDrivenDesignExtension;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\HttpKernel\Bundle\Bundle;
/**
*
*/
final class PhpDDDDomainDrivenDesignBundle extends Bundle
{
/**
* @var array
*/
private static $dispatcherOptions = [
'command' => [
'service_id' => 'domain_driven_design.command_dispatcher',
'tag_name' => 'domain_driven_design.command_subscriber',
'method' => 'register',
],
'event' => [
'service_id' => 'domain_driven_design.event_dispatcher',
'tag_name' => 'domain_driven_design.event_subscriber',
'method' => 'subscribe',
],
];
/**
* @param ContainerBuilder $container
*/
public function build(ContainerBuilder $container)
{
parent::build($container);
foreach (self::$dispatcherOptions as $options) {
$container->addCompilerPass(
new DispatcherCompilerPass($options['service_id'], $options['tag_name'], $options['method'])
);
}
}
/**
* @return DomainDrivenDesignExtension
*/
public function getContainerExtension()
{
return $this->extension = new DomainDrivenDesignExtension();
}
}