18
18
use Doctrine \ODM \PHPCR \Version as PHPCRVersion ;
19
19
use Doctrine \ORM \Mapping \Driver \XmlDriver as ORMXmlDriver ;
20
20
use Doctrine \ORM \Version as ORMVersion ;
21
- use Symfony \Bridge \Doctrine \DependencyInjection \CompilerPass \RegisterMappingsPass ;
22
21
use Symfony \Cmf \Bundle \RoutingBundle \DependencyInjection \Compiler \ValidationPass ;
23
22
use Symfony \Component \DependencyInjection \Compiler \CompilerPassInterface ;
24
23
use Symfony \Component \DependencyInjection \Definition ;
27
26
use Symfony \Cmf \Component \Routing \DependencyInjection \Compiler \RegisterRoutersPass ;
28
27
use Symfony \Cmf \Component \Routing \DependencyInjection \Compiler \RegisterRouteEnhancersPass ;
29
28
use Symfony \Cmf \Bundle \RoutingBundle \DependencyInjection \Compiler \SetRouterPass ;
30
- use Symfony \Cmf \Bundle \CoreBundle \DependencyInjection \Compiler \DoctrineOrmMappingsPass as CmfDoctrineOrmMappingsPass ;
31
29
32
30
/**
33
31
* Bundle class.
@@ -57,9 +55,7 @@ public function build(ContainerBuilder $container)
57
55
*/
58
56
private function buildPhpcrCompilerPass (ContainerBuilder $ container )
59
57
{
60
- if (!class_exists (DoctrinePhpcrMappingsPass::class)
61
- || !class_exists (PHPCRVersion::class)
62
- ) {
58
+ if (!class_exists (PHPCRVersion::class)) {
63
59
return ;
64
60
}
65
61
@@ -91,16 +87,11 @@ private function buildOrmCompilerPass(ContainerBuilder $container)
91
87
return ;
92
88
}
93
89
94
- $ doctrineOrmCompiler = $ this ->findDoctrineOrmCompiler ();
95
- if (!$ doctrineOrmCompiler ) {
96
- return ;
97
- }
98
-
99
90
$ container ->addCompilerPass (
100
- $ this ->buildBaseCompilerPass ($ doctrineOrmCompiler , ORMXmlDriver::class, 'orm ' )
91
+ $ this ->buildBaseCompilerPass (DoctrineOrmMappingsPass::class , ORMXmlDriver::class, 'orm ' )
101
92
);
102
93
$ container ->addCompilerPass (
103
- $ doctrineOrmCompiler ::createXmlMappingDriver (
94
+ DoctrineOrmMappingsPass ::createXmlMappingDriver (
104
95
[
105
96
realpath (__DIR__ .'/Resources/config/doctrine-model ' ) => 'Symfony\Cmf\Bundle\RoutingBundle\Model ' ,
106
97
realpath (__DIR__ .'/Resources/config/doctrine-orm ' ) => 'Symfony\Cmf\Bundle\RoutingBundle\Doctrine\Orm ' ,
@@ -112,7 +103,7 @@ private function buildOrmCompilerPass(ContainerBuilder $container)
112
103
);
113
104
114
105
$ container ->addCompilerPass (
115
- $ doctrineOrmCompiler ::createXmlMappingDriver (
106
+ DoctrineOrmMappingsPass ::createXmlMappingDriver (
116
107
[
117
108
realpath (__DIR__ .'/Resources/config/doctrine-model ' ) => 'Symfony\Cmf\Bundle\RoutingBundle\Model ' ,
118
109
],
@@ -123,29 +114,6 @@ private function buildOrmCompilerPass(ContainerBuilder $container)
123
114
);
124
115
}
125
116
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
-
149
117
/**
150
118
* Builds the compiler pass for the symfony core routing component. The
151
119
* compiler pass factory method uses the SymfonyFileLocator which does
0 commit comments