Skip to content

Commit 341e1bf

Browse files
committed
minor #60911 [DoctrineBridge] use native lazy objects on PHP 8.4+ when available (xabbuh)
This PR was merged into the 6.4 branch. Discussion ---------- [DoctrineBridge] use native lazy objects on PHP 8.4+ when available | Q | A | ------------- | --- | Branch? | 6.4 | Bug fix? | no | New feature? | no | Deprecations? | no | Issues | | License | MIT following the changes from doctrine/orm#12005 and doctrine/orm#12020 Commits ------- 1256ce9 use native lazy objects on PHP 8.4+ when available
2 parents c6f3da1 + 1256ce9 commit 341e1bf

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

src/Symfony/Bridge/Doctrine/Tests/DoctrineTestHelper.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,11 @@ public static function createTestConfiguration(): Configuration
5858
{
5959
$config = ORMSetup::createConfiguration(true);
6060
$config->setEntityNamespaces(['SymfonyTestsDoctrine' => 'Symfony\Bridge\Doctrine\Tests\Fixtures']);
61-
$config->setAutoGenerateProxyClasses(true);
62-
$config->setProxyDir(sys_get_temp_dir());
63-
$config->setProxyNamespace('SymfonyTests\Doctrine');
61+
if (\PHP_VERSION_ID < 80400 || !method_exists($config, 'enableNativeLazyObjects')) {
62+
$config->setAutoGenerateProxyClasses(true);
63+
$config->setProxyDir(sys_get_temp_dir());
64+
$config->setProxyNamespace('SymfonyTests\Doctrine');
65+
}
6466
$config->setMetadataDriverImpl(new AttributeDriver([__DIR__.'/../Tests/Fixtures' => 'Symfony\Bridge\Doctrine\Tests\Fixtures'], true));
6567
if (class_exists(DefaultSchemaManagerFactory::class)) {
6668
$config->setSchemaManagerFactory(new DefaultSchemaManagerFactory());

src/Symfony/Bridge/Doctrine/Tests/PropertyInfo/DoctrineExtractorTest.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,11 @@ private function createExtractor(): DoctrineExtractor
4545
$config->setSchemaManagerFactory(new DefaultSchemaManagerFactory());
4646
}
4747
if (!class_exists(\Doctrine\Persistence\Mapping\Driver\AnnotationDriver::class)) { // doctrine/persistence >= 3.0
48-
$config->setLazyGhostObjectEnabled(true);
48+
if (\PHP_VERSION_ID >= 80400 && method_exists($config, 'enableNativeLazyObjects')) {
49+
$config->enableNativeLazyObjects(true);
50+
} else {
51+
$config->setLazyGhostObjectEnabled(true);
52+
}
4953
}
5054

5155
$eventManager = new EventManager();

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy