Skip to content

Commit 5274e95

Browse files
committed
[Tests] Enable native lazy objects when possible
1 parent d544e7e commit 5274e95

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
},
2929
"require-dev": {
3030
"composer/semver": "^3.0",
31-
"doctrine/doctrine-bundle": "^2.5.0",
31+
"doctrine/doctrine-bundle": "^2.5.0|^3.0.0",
3232
"doctrine/orm": "^2.15|^3",
3333
"symfony/http-client": "^6.4|^7.0|^8.0",
3434
"symfony/phpunit-bridge": "^6.4.1|^7.0|^8.0",

tests/Doctrine/EntityRegeneratorTest.php

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
namespace Symfony\Bundle\MakerBundle\Tests\Doctrine;
1313

14+
use Composer\InstalledVersions;
1415
use Doctrine\Bundle\DoctrineBundle\DoctrineBundle;
1516
use Doctrine\Persistence\Reflection\RuntimeReflectionProperty;
1617
use PHPUnit\Framework\TestCase;
@@ -175,9 +176,13 @@ protected function configureContainer(ContainerBuilder $c, LoaderInterface $load
175176
],
176177
];
177178

178-
/* @legacy Remove conditional when doctrine/persistence <3.1 are no longer supported. */
179-
if (class_exists(RuntimeReflectionProperty::class)) {
180-
$orm['enable_lazy_ghost_objects'] = true;
179+
if (null !== $doctrineBundleVersion = InstalledVersions::getVersion('doctrine/doctrine-bundle')) {
180+
if (version_compare($doctrineBundleVersion, '2.8.0', '>=')) {
181+
$orm['enable_lazy_ghost_objects'] = true;
182+
}
183+
if (\PHP_VERSION_ID >= 80400 && version_compare($doctrineBundleVersion, '2.15.0', '>=')) {
184+
$orm['enable_native_lazy_objects'] = true;
185+
}
181186
}
182187

183188
$c->prependExtensionConfig('doctrine', [

0 commit comments

Comments
 (0)