|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/* |
|
4
|
|
|
* This file is part of the Ivoaz ContentEditable bundle. |
|
5
|
|
|
* |
|
6
|
|
|
* (c) Ivo Azirjans <[email protected]> |
|
7
|
|
|
* |
|
8
|
|
|
* This source file is subject to the MIT license that is bundled |
|
9
|
|
|
* with this source code in the file LICENSE. |
|
10
|
|
|
*/ |
|
11
|
|
|
|
|
12
|
|
|
namespace Ivoaz\Bundle\ContentEditableBundle; |
|
13
|
|
|
|
|
14
|
|
|
use Doctrine\Bundle\DoctrineBundle\DependencyInjection\Compiler\DoctrineOrmMappingsPass; |
|
15
|
|
|
use Doctrine\Bundle\MongoDBBundle\DependencyInjection\Compiler\DoctrineMongoDBMappingsPass; |
|
16
|
|
|
use Symfony\Component\DependencyInjection\ContainerBuilder; |
|
17
|
|
|
use Symfony\Component\HttpKernel\Bundle\Bundle; |
|
18
|
|
|
|
|
19
|
|
|
class IvoazContentEditableBundle extends Bundle |
|
20
|
|
|
{ |
|
21
|
|
|
public function build(ContainerBuilder $container) |
|
22
|
|
|
{ |
|
23
|
|
|
parent::build($container); |
|
24
|
|
|
|
|
25
|
|
|
$modelDir = realpath(__DIR__.'/Resources/config/doctrine/model'); |
|
26
|
|
|
$mappings = [$modelDir => 'Ivoaz\Bundle\ContentEditableBundle\Model']; |
|
27
|
|
|
|
|
28
|
|
|
$ormCompilerClass = 'Doctrine\Bundle\DoctrineBundle\DependencyInjection\Compiler\DoctrineOrmMappingsPass'; |
|
29
|
|
|
if (class_exists($ormCompilerClass)) { |
|
30
|
|
|
$container->addCompilerPass( |
|
31
|
|
|
DoctrineOrmMappingsPass::createXmlMappingDriver( |
|
32
|
|
|
$mappings, |
|
33
|
|
|
['ivoaz_content_editable.model_manager_name'], |
|
34
|
|
|
'ivoaz_content_editable.model_type_orm', |
|
35
|
|
|
['IvoazContentEditableBundle' => 'Symfony\Cmf\RoutingBundle\Model'] |
|
36
|
|
|
) |
|
37
|
|
|
); |
|
38
|
|
|
} |
|
39
|
|
|
|
|
40
|
|
|
$mongoCompilerClass = 'Doctrine\Bundle\MongoDBBundle\DependencyInjection\Compiler\DoctrineMongoDBMappingsPass'; |
|
41
|
|
|
if (class_exists($mongoCompilerClass)) { |
|
42
|
|
|
$container->addCompilerPass( |
|
43
|
|
|
DoctrineMongoDBMappingsPass::createXmlMappingDriver( |
|
44
|
|
|
$mappings, |
|
45
|
|
|
['ivoaz_content_editable.model_manager_name'], |
|
46
|
|
|
'ivoaz_content_editable.model_type_mongodb', |
|
47
|
|
|
['IvoazContentEditableBundle' => 'Symfony\Cmf\RoutingBundle\Model'] |
|
48
|
|
|
) |
|
49
|
|
|
); |
|
50
|
|
|
} |
|
51
|
|
|
} |
|
52
|
|
|
} |
|
53
|
|
|
|