Skip to content
This repository was archived by the owner on Sep 16, 2021. It is now read-only.

Commit 4b2e3af

Browse files
committed
Do not register document if RoutingBundle not registered
1 parent 00e2d1f commit 4b2e3af

File tree

2 files changed

+14
-18
lines changed

2 files changed

+14
-18
lines changed

CmfRoutingAutoBundle.php

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -40,16 +40,20 @@ private function buildPhpcrCompilerPass(ContainerBuilder $container)
4040
return;
4141
}
4242

43-
$container->addCompilerPass(
44-
DoctrinePhpcrMappingsPass::createXmlMappingDriver(
45-
array(
46-
realpath(__DIR__.'/Resources/config/doctrine-model') => 'Symfony\Cmf\Bundle\RoutingAutoBundle\Model',
47-
),
48-
array('cmf_routing_auto.persistence.phpcr.manager_name'),
49-
false,
50-
array('CmfRoutingAutoBundle' => 'Symfony\Cmf\Bundle\RoutingAutoBundle\Model')
51-
)
52-
);
43+
$bundles = $container->getParameter('kernel.bundles');
44+
45+
if (isset($bundles['CmfRoutingBundle'])) {
46+
$container->addCompilerPass(
47+
DoctrinePhpcrMappingsPass::createXmlMappingDriver(
48+
array(
49+
realpath(__DIR__.'/Resources/config/doctrine-model') => 'Symfony\Cmf\Bundle\RoutingAutoBundle\Model',
50+
),
51+
array('cmf_routing_auto.persistence.phpcr.manager_name'),
52+
false,
53+
array('CmfRoutingAutoBundle' => 'Symfony\Cmf\Bundle\RoutingAutoBundle\Model')
54+
)
55+
);
56+
}
5357
}
5458

5559
}

Tests/Unit/Adapter/PhpcrOdmAdapterTest.php

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -116,10 +116,6 @@ public function testCreateAutoRoute($path, $expectedParentPath, $expectedName, $
116116
}
117117

118118
$this->uriContext->getUri()->willReturn($path);
119-
<<<<<<< HEAD
120-
121-
=======
122-
>>>>>>> Added possiblity to register custom adapters
123119
$res = $this->adapter->createAutoRoute($this->uriContext->reveal(), $this->contentDocument, 'fr');
124120
$this->assertNotNull($res);
125121
$this->assertInstanceOf('Symfony\Cmf\Bundle\RoutingAutoBundle\Model\AutoRoute', $res);
@@ -137,11 +133,7 @@ public function testCreateAutoRouteNonExistingBasePath()
137133
{
138134
$this->dm->getPhpcrSession()->willReturn($this->phpcrSession);
139135
$this->dm->find(null, $this->baseRoutePath)->willReturn(null);
140-
<<<<<<< HEAD
141136
$this->uriContext->getUri()->willReturn('/asdasd');
142-
=======
143-
$this->uriContext->getUri()->willReturn('/foo');
144-
>>>>>>> Added possiblity to register custom adapters
145137
$this->adapter->createAutoRoute($this->uriContext->reveal(), $this->contentDocument, 'fr');
146138
}
147139

0 commit comments

Comments
 (0)