Skip to content

Commit 69b69a7

Browse files
committed
we don't need the mapping pass from core bundle anymore
1 parent 9ec030c commit 69b69a7

File tree

2 files changed

+5
-37
lines changed

2 files changed

+5
-37
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
"suggest": {
3737
"doctrine/phpcr-odm": "To enable support for the PHPCR ODM documents (^1.3)",
3838
"doctrine/phpcr-bundle": "To enable support for the PHPCR ODM documents",
39-
"doctrine/orm": "To enable support for the ORM entities (^2.3)",
39+
"doctrine/orm": "To enable support for the ORM entities (^2.5)",
4040

4141
"symfony-cmf/content-bundle": "To optionally use the configured value for 'content_basepath' from the CoreBundle",
4242
"symfony-cmf/core-bundle": "To use the provided Doctrine\\Phpcr documents and for easier configuration (^1.1)",

src/CmfRoutingBundle.php

Lines changed: 4 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
use Doctrine\ODM\PHPCR\Version as PHPCRVersion;
1919
use Doctrine\ORM\Mapping\Driver\XmlDriver as ORMXmlDriver;
2020
use Doctrine\ORM\Version as ORMVersion;
21-
use Symfony\Bridge\Doctrine\DependencyInjection\CompilerPass\RegisterMappingsPass;
2221
use Symfony\Cmf\Bundle\RoutingBundle\DependencyInjection\Compiler\ValidationPass;
2322
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
2423
use Symfony\Component\DependencyInjection\Definition;
@@ -27,7 +26,6 @@
2726
use Symfony\Cmf\Component\Routing\DependencyInjection\Compiler\RegisterRoutersPass;
2827
use Symfony\Cmf\Component\Routing\DependencyInjection\Compiler\RegisterRouteEnhancersPass;
2928
use Symfony\Cmf\Bundle\RoutingBundle\DependencyInjection\Compiler\SetRouterPass;
30-
use Symfony\Cmf\Bundle\CoreBundle\DependencyInjection\Compiler\DoctrineOrmMappingsPass as CmfDoctrineOrmMappingsPass;
3129

3230
/**
3331
* Bundle class.
@@ -57,9 +55,7 @@ public function build(ContainerBuilder $container)
5755
*/
5856
private function buildPhpcrCompilerPass(ContainerBuilder $container)
5957
{
60-
if (!class_exists(DoctrinePhpcrMappingsPass::class)
61-
|| !class_exists(PHPCRVersion::class)
62-
) {
58+
if (!class_exists(PHPCRVersion::class)) {
6359
return;
6460
}
6561

@@ -91,16 +87,11 @@ private function buildOrmCompilerPass(ContainerBuilder $container)
9187
return;
9288
}
9389

94-
$doctrineOrmCompiler = $this->findDoctrineOrmCompiler();
95-
if (!$doctrineOrmCompiler) {
96-
return;
97-
}
98-
9990
$container->addCompilerPass(
100-
$this->buildBaseCompilerPass($doctrineOrmCompiler, ORMXmlDriver::class, 'orm')
91+
$this->buildBaseCompilerPass(DoctrineOrmMappingsPass::class, ORMXmlDriver::class, 'orm')
10192
);
10293
$container->addCompilerPass(
103-
$doctrineOrmCompiler::createXmlMappingDriver(
94+
DoctrineOrmMappingsPass::createXmlMappingDriver(
10495
[
10596
realpath(__DIR__.'/Resources/config/doctrine-model') => 'Symfony\Cmf\Bundle\RoutingBundle\Model',
10697
realpath(__DIR__.'/Resources/config/doctrine-orm') => 'Symfony\Cmf\Bundle\RoutingBundle\Doctrine\Orm',
@@ -112,7 +103,7 @@ private function buildOrmCompilerPass(ContainerBuilder $container)
112103
);
113104

114105
$container->addCompilerPass(
115-
$doctrineOrmCompiler::createXmlMappingDriver(
106+
DoctrineOrmMappingsPass::createXmlMappingDriver(
116107
[
117108
realpath(__DIR__.'/Resources/config/doctrine-model') => 'Symfony\Cmf\Bundle\RoutingBundle\Model',
118109
],
@@ -123,29 +114,6 @@ private function buildOrmCompilerPass(ContainerBuilder $container)
123114
);
124115
}
125116

126-
/**
127-
* Looks for a mapping compiler pass. If available, use the one from
128-
* DoctrineBundle (available only since DoctrineBundle 2.4 and Symfony 2.3)
129-
* Otherwise use the standalone one from CmfCoreBundle.
130-
*
131-
* @return bool|string the compiler pass to use or false if no suitable
132-
* one was found
133-
*/
134-
private function findDoctrineOrmCompiler()
135-
{
136-
if (class_exists(RegisterMappingsPass::class)
137-
&& class_exists(DoctrineOrmMappingsPass::class)
138-
) {
139-
return DoctrineOrmMappingsPass::class;
140-
}
141-
142-
if (class_exists(CmfDoctrineOrmMappingsPass::class)) {
143-
return CmfDoctrineOrmMappingsPass::class;
144-
}
145-
146-
return false;
147-
}
148-
149117
/**
150118
* Builds the compiler pass for the symfony core routing component. The
151119
* compiler pass factory method uses the SymfonyFileLocator which does

0 commit comments

Comments
 (0)