From 805e53480f43916970fd686acd19825927d8595d Mon Sep 17 00:00:00 2001 From: David Buchmann Date: Thu, 1 Jun 2023 13:02:35 +0200 Subject: [PATCH 1/2] no longer register CmfRoutingBundle alias when using doctrine/persistence 3.* --- CHANGELOG.md | 5 +++++ src/CmfRoutingBundle.php | 15 +++++++++++++-- src/Doctrine/Phpcr/LocaleListener.php | 2 +- 3 files changed, 19 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c4fa9dd5..5ff50f97 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,11 @@ Changelog ========= +3.0.2 +----- + +* Do not register CmfRoutingBundle alias for ORM / PHPCR-ODM when we have doctrine/persistence 3.x as the short alias is no longer supported. + 3.0.1 ----- diff --git a/src/CmfRoutingBundle.php b/src/CmfRoutingBundle.php index cd6d354a..ebe8640f 100644 --- a/src/CmfRoutingBundle.php +++ b/src/CmfRoutingBundle.php @@ -13,6 +13,7 @@ use Doctrine\Bundle\DoctrineBundle\DependencyInjection\Compiler\DoctrineOrmMappingsPass; use Doctrine\Bundle\PHPCRBundle\DependencyInjection\Compiler\DoctrinePhpcrMappingsPass; +use Doctrine\Common\Persistence\PersistentObject; use Doctrine\ODM\PHPCR\Mapping\Driver\XmlDriver as PHPCRXmlDriver; use Doctrine\ODM\PHPCR\Version as PHPCRVersion; use Doctrine\ORM\EntityManagerInterface; @@ -56,6 +57,11 @@ private function buildPhpcrCompilerPass(ContainerBuilder $container): void $container->addCompilerPass( $this->buildBaseCompilerPass(DoctrinePhpcrMappingsPass::class, PHPCRXmlDriver::class, 'phpcr') ); + $aliasMap = []; + // short alias is no longer supported in doctrine/persistence 3, but keep aliasing for BC with old installations + if (class_exists(PersistentObject::class)) { + $aliasMap = ['CmfRoutingBundle' => 'Symfony\Cmf\Bundle\RoutingBundle\Doctrine\Phpcr']; + } $container->addCompilerPass( DoctrinePhpcrMappingsPass::createXmlMappingDriver( [ @@ -64,7 +70,7 @@ private function buildPhpcrCompilerPass(ContainerBuilder $container): void ], ['cmf_routing.dynamic.persistence.phpcr.manager_name'], 'cmf_routing.backend_type_phpcr', - ['CmfRoutingBundle' => 'Symfony\Cmf\Bundle\RoutingBundle\Doctrine\Phpcr'] + $aliasMap ) ); } @@ -81,6 +87,11 @@ private function buildOrmCompilerPass(ContainerBuilder $container): void $container->addCompilerPass( $this->buildBaseCompilerPass(DoctrineOrmMappingsPass::class, ORMXmlDriver::class, 'orm') ); + $aliasMap = []; + // short alias is no longer supported in doctrine/persistence 3, but keep aliasing for BC with old installations + if (class_exists(PersistentObject::class)) { + $aliasMap = ['CmfRoutingBundle' => 'Symfony\Cmf\Bundle\RoutingBundle\Doctrine\Orm']; + } $container->addCompilerPass( DoctrineOrmMappingsPass::createXmlMappingDriver( [ @@ -89,7 +100,7 @@ private function buildOrmCompilerPass(ContainerBuilder $container): void ], ['cmf_routing.dynamic.persistence.orm.manager_name'], 'cmf_routing.backend_type_orm_default', - ['CmfRoutingBundle' => 'Symfony\Cmf\Bundle\RoutingBundle\Doctrine\Orm'] + $aliasMap ) ); diff --git a/src/Doctrine/Phpcr/LocaleListener.php b/src/Doctrine/Phpcr/LocaleListener.php index f45e1a38..b7a51ce4 100644 --- a/src/Doctrine/Phpcr/LocaleListener.php +++ b/src/Doctrine/Phpcr/LocaleListener.php @@ -88,7 +88,7 @@ public function setLocales(array $locales): void /** * Whether to make the route prepend the locale pattern if it does not - * have one of the allowed locals in its id. + * have one of the allowed locales in its id. */ public function setAddLocalePattern(bool $addLocalePattern): void { From 028b3d797da0e501d9bb9930d402c12ff91b6e84 Mon Sep 17 00:00:00 2001 From: David Buchmann Date: Sat, 3 Jun 2023 11:40:27 +0200 Subject: [PATCH 2/2] allow flex plugin to run --- .github/workflows/test-application.yaml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test-application.yaml b/.github/workflows/test-application.yaml index 771e04ee..000a0a3f 100644 --- a/.github/workflows/test-application.yaml +++ b/.github/workflows/test-application.yaml @@ -40,7 +40,9 @@ jobs: tools: 'composer:v2' - name: Install Symfony Flex - run: composer global require --no-progress --no-scripts --no-plugins symfony/flex + run: | + composer global config --no-plugins allow-plugins.symfony/flex true + composer global require --no-progress --no-scripts --no-plugins symfony/flex - name: Install dependencies with Composer uses: ramsey/composer-install@v1