forked from symfony-cmf/routing-auto-bundle
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCmfRoutingAutoBundle.php
More file actions
52 lines (45 loc) · 1.63 KB
/
Copy pathCmfRoutingAutoBundle.php
File metadata and controls
52 lines (45 loc) · 1.63 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
47
48
49
50
51
52
<?php
/*
* This file is part of the Symfony CMF package.
*
* (c) 2011-2013 Symfony CMF
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Cmf\Bundle\RoutingAutoBundle;
use Symfony\Component\HttpKernel\Bundle\Bundle;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Cmf\Bundle\RoutingAutoBundle\DependencyInjection\Compiler\AutoRoutePass;
use Doctrine\Bundle\PHPCRBundle\DependencyInjection\Compiler\DoctrinePhpcrMappingsPass;
class CmfRoutingAutoBundle extends Bundle
{
public function build(ContainerBuilder $container)
{
parent::build($container);
$container->addCompilerPass(new AutoRoutePass());
$this->buildPhpcrCompilerPass($container);
}
/**
* Creates and registers compiler passes for PHPCR-ODM mapping if both the
* phpcr-odm and the phpcr-bundle are present.
*
* @param ContainerBuilder $container
*/
private function buildPhpcrCompilerPass(ContainerBuilder $container)
{
if (!class_exists('Doctrine\Bundle\PHPCRBundle\DependencyInjection\Compiler\DoctrinePhpcrMappingsPass')
|| !class_exists('Doctrine\ODM\PHPCR\Version')
) {
return;
}
$container->addCompilerPass(
DoctrinePhpcrMappingsPass::createXmlMappingDriver(
array(
realpath(__DIR__.'/Resources/config/doctrine-model') => 'Symfony\Cmf\Bundle\RoutingAutoBundle\Model',
),
array('cmf_routing_auto.persistence.phpcr.manager_name')
)
);
}
}