1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/* |
4
|
|
|
* This file is part of the Shared Kernel library. |
5
|
|
|
* |
6
|
|
|
* Copyright (c) 2016-present LIN3S <[email protected]> |
7
|
|
|
* |
8
|
|
|
* For the full copyright and license information, please view the LICENSE |
9
|
|
|
* file that was distributed with this source code. |
10
|
|
|
*/ |
11
|
|
|
|
12
|
|
|
namespace LIN3S\SharedKernel\Infrastructure\Symfony\Bundle; |
13
|
|
|
|
14
|
|
|
use LIN3S\SharedKernel\Infrastructure\Persistence\Doctrine\ORM\Types\PhoneType; |
15
|
|
|
use LIN3S\SharedKernel\Infrastructure\Symfony\Bundle\DependencyInjection\Compiler\DoctrineORMCustomTypesPass; |
16
|
|
|
use Symfony\Component\DependencyInjection\Compiler\PassConfig; |
17
|
|
|
use Symfony\Component\DependencyInjection\ContainerBuilder; |
18
|
|
|
use Symfony\Component\HttpKernel\Bundle\Bundle; |
19
|
|
|
|
20
|
|
|
/** |
21
|
|
|
* @author Beñat Espiña <[email protected]> |
22
|
|
|
*/ |
23
|
|
|
class Lin3sSharedKernelBundle extends Bundle |
24
|
|
|
{ |
25
|
|
|
public function build(ContainerBuilder $container) |
26
|
|
|
{ |
27
|
|
|
$container->addCompilerPass(new DoctrineORMCustomTypesPass(), PassConfig::TYPE_OPTIMIZE); |
28
|
|
|
|
29
|
|
|
$container->loadFromExtension('doctrine', [ |
30
|
|
|
'orm' => [ |
31
|
|
|
'mappings' => [ |
32
|
|
|
'Lin3sSharedKernelEmail' => [ |
33
|
|
|
'type' => 'xml', |
34
|
|
|
'is_bundle' => false, |
35
|
|
|
'dir' => $this->basePath() . '/Email/Mapping/', |
36
|
|
|
'prefix' => 'LIN3S\SharedKernel\Domain\Model\Email', |
37
|
|
|
], |
38
|
|
|
'Lin3sSharedKernelSlug' => [ |
39
|
|
|
'type' => 'xml', |
40
|
|
|
'is_bundle' => false, |
41
|
|
|
'dir' => $this->basePath() . '/Slug/Mapping/', |
42
|
|
|
'prefix' => 'LIN3S\SharedKernel\Domain\Model\Slug', |
43
|
|
|
], |
44
|
|
|
], |
45
|
|
|
], |
46
|
|
|
]); |
47
|
|
|
} |
48
|
|
|
|
49
|
|
|
private function basePath() |
50
|
|
|
{ |
51
|
|
|
$directory = dirname((new \ReflectionClass(self::class))->getFileName()); |
52
|
|
|
|
53
|
|
|
return $directory . '/../../Persistence/Doctrine/ORM'; |
54
|
|
|
} |
55
|
|
|
} |
56
|
|
|
|