1313
1414use Doctrine \Bundle \DoctrineBundle \DependencyInjection \Compiler \DoctrineOrmMappingsPass ;
1515use Doctrine \Bundle \PHPCRBundle \DependencyInjection \Compiler \DoctrinePhpcrMappingsPass ;
16+ use Doctrine \Common \Persistence \PersistentObject ;
1617use Doctrine \ODM \PHPCR \Mapping \Driver \XmlDriver as PHPCRXmlDriver ;
1718use Doctrine \ODM \PHPCR \Version as PHPCRVersion ;
1819use Doctrine \ORM \EntityManagerInterface ;
@@ -56,6 +57,11 @@ private function buildPhpcrCompilerPass(ContainerBuilder $container): void
5657 $ container ->addCompilerPass (
5758 $ this ->buildBaseCompilerPass (DoctrinePhpcrMappingsPass::class, PHPCRXmlDriver::class, 'phpcr ' )
5859 );
60+ $ aliasMap = [];
61+ // short alias is no longer supported in doctrine/persistence 3, but keep aliasing for BC with old installations
62+ if (class_exists (PersistentObject::class)) {
63+ $ aliasMap = ['CmfRoutingBundle ' => 'Symfony\Cmf\Bundle\RoutingBundle\Doctrine\Phpcr ' ];
64+ }
5965 $ container ->addCompilerPass (
6066 DoctrinePhpcrMappingsPass::createXmlMappingDriver (
6167 [
@@ -64,7 +70,7 @@ private function buildPhpcrCompilerPass(ContainerBuilder $container): void
6470 ],
6571 ['cmf_routing.dynamic.persistence.phpcr.manager_name ' ],
6672 'cmf_routing.backend_type_phpcr ' ,
67- [ ' CmfRoutingBundle ' => ' Symfony\Cmf\Bundle\RoutingBundle\Doctrine\Phpcr ' ]
73+ $ aliasMap
6874 )
6975 );
7076 }
@@ -81,6 +87,11 @@ private function buildOrmCompilerPass(ContainerBuilder $container): void
8187 $ container ->addCompilerPass (
8288 $ this ->buildBaseCompilerPass (DoctrineOrmMappingsPass::class, ORMXmlDriver::class, 'orm ' )
8389 );
90+ $ aliasMap = [];
91+ // short alias is no longer supported in doctrine/persistence 3, but keep aliasing for BC with old installations
92+ if (class_exists (PersistentObject::class)) {
93+ $ aliasMap = ['CmfRoutingBundle ' => 'Symfony\Cmf\Bundle\RoutingBundle\Doctrine\Orm ' ];
94+ }
8495 $ container ->addCompilerPass (
8596 DoctrineOrmMappingsPass::createXmlMappingDriver (
8697 [
@@ -89,7 +100,7 @@ private function buildOrmCompilerPass(ContainerBuilder $container): void
89100 ],
90101 ['cmf_routing.dynamic.persistence.orm.manager_name ' ],
91102 'cmf_routing.backend_type_orm_default ' ,
92- [ ' CmfRoutingBundle ' => ' Symfony\Cmf\Bundle\RoutingBundle\Doctrine\Orm ' ]
103+ $ aliasMap
93104 )
94105 );
95106
0 commit comments