-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFDevsTagBundle.php
More file actions
46 lines (39 loc) · 1.43 KB
/
FDevsTagBundle.php
File metadata and controls
46 lines (39 loc) · 1.43 KB
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
<?php
namespace FDevs\TagBundle;
use Doctrine\Bundle\MongoDBBundle\DependencyInjection\Compiler\DoctrineMongoDBMappingsPass;
use FDevs\TagBundle\DependencyInjection\Compiler\SerializerPass;
use FDevs\TagBundle\DependencyInjection\Compiler\ValidationPass;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\HttpKernel\Bundle\Bundle;
class FDevsTagBundle extends Bundle
{
/**
* {@inheritdoc}
*/
public function build(ContainerBuilder $container)
{
parent::build($container);
$this->addRegisterMappingsPass($container);
$container
->addCompilerPass(new SerializerPass())
->addCompilerPass(new ValidationPass())
;
}
/**
* @param ContainerBuilder $container
*/
private function addRegisterMappingsPass(ContainerBuilder $container)
{
$refl = new \ReflectionClass('FDevs\Tag\TagInterface');
$mappings = [realpath(dirname($refl->getFileName()).'/Resources/doctrine/model') => 'FDevs\Tag\Model'];
if (class_exists('Doctrine\Bundle\MongoDBBundle\DependencyInjection\Compiler\DoctrineMongoDBMappingsPass')) {
$container->addCompilerPass(
DoctrineMongoDBMappingsPass::createXmlMappingDriver(
$mappings,
['f_devs_tag.model_manager_name'],
'f_devs_tag.backend_type_mongodb'
)
);
}
}
}