diff --git a/composer.json b/composer.json index dc5d5b767..a583015aa 100644 --- a/composer.json +++ b/composer.json @@ -28,7 +28,7 @@ }, "require-dev": { "composer/semver": "^3.0", - "doctrine/doctrine-bundle": "^2.5.0|^3.0.0", + "doctrine/doctrine-bundle": "^2.10|^3.0", "doctrine/orm": "^2.15|^3", "doctrine/persistence": "^3.1|^4.0", "symfony/http-client": "^6.4|^7.0|^8.0", diff --git a/tests/Doctrine/EntityRegeneratorTest.php b/tests/Doctrine/EntityRegeneratorTest.php index bb1f3c264..316dd618f 100644 --- a/tests/Doctrine/EntityRegeneratorTest.php +++ b/tests/Doctrine/EntityRegeneratorTest.php @@ -12,6 +12,7 @@ namespace Symfony\Bundle\MakerBundle\Tests\Doctrine; use Composer\InstalledVersions; +use Composer\Semver\VersionParser; use Doctrine\Bundle\DoctrineBundle\DoctrineBundle; use PHPUnit\Framework\TestCase; use Symfony\Bundle\FrameworkBundle\FrameworkBundle; @@ -175,13 +176,12 @@ protected function configureContainer(ContainerBuilder $c, LoaderInterface $load ], ]; - if (null !== $doctrineBundleVersion = InstalledVersions::getVersion('doctrine/doctrine-bundle')) { - if (version_compare($doctrineBundleVersion, '2.8.0', '>=')) { - $orm['enable_lazy_ghost_objects'] = true; - } - if (\PHP_VERSION_ID >= 80400 && version_compare($doctrineBundleVersion, '2.15.0', '>=')) { - $orm['enable_native_lazy_objects'] = true; - } + if (InstalledVersions::satisfies(new VersionParser(), 'doctrine/doctrine-bundle', '^2.8')) { + $orm['enable_lazy_ghost_objects'] = true; + } + + if (\PHP_VERSION_ID >= 80400 && InstalledVersions::satisfies(new VersionParser(), 'doctrine/doctrine-bundle', '^2.15')) { + $orm['enable_native_lazy_objects'] = true; } $c->prependExtensionConfig('doctrine', [