Skip to content

[DoctrineBridge] Fix compatibility to Doctrine persistence 2.5 in Doctrine Bridge 6.4 to avoid Projects stuck on 6.3 #59185

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
"ext-xml": "*",
"friendsofphp/proxy-manager-lts": "^1.0.2",
"doctrine/event-manager": "^1.2|^2",
"doctrine/persistence": "^3.1",
"doctrine/persistence": "^2.5|^3.1",
"twig/twig": "^2.13|^3.0.4",
"psr/cache": "^2.0|^3.0",
"psr/clock": "^1.0",
Expand Down
5 changes: 4 additions & 1 deletion src/Symfony/Bridge/Doctrine/Tests/DoctrineTestHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,10 @@ public static function createTestConfiguration(): Configuration
if (class_exists(DefaultSchemaManagerFactory::class)) {
$config->setSchemaManagerFactory(new DefaultSchemaManagerFactory());
}
$config->setLazyGhostObjectEnabled(true);

if (!class_exists(\Doctrine\Persistence\Mapping\Driver\AnnotationDriver::class)) { // doctrine/persistence >= 3.0
$config->setLazyGhostObjectEnabled(true);
}

return $config;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,9 @@ private function init(bool $withStopwatch = true): void
if (class_exists(DefaultSchemaManagerFactory::class)) {
$config->setSchemaManagerFactory(new DefaultSchemaManagerFactory());
}
$config->setLazyGhostObjectEnabled(true);
if (!class_exists(\Doctrine\Persistence\Mapping\Driver\AnnotationDriver::class)) { // doctrine/persistence >= 3.0
$config->setLazyGhostObjectEnabled(true);
}
$this->debugDataHolder = new DebugDataHolder();
$config->setMiddlewares([new Middleware($this->debugDataHolder, $this->stopwatch)]);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,9 @@ private function createExtractor(): DoctrineExtractor
if (class_exists(DefaultSchemaManagerFactory::class)) {
$config->setSchemaManagerFactory(new DefaultSchemaManagerFactory());
}
$config->setLazyGhostObjectEnabled(true);
if (!class_exists(\Doctrine\Persistence\Mapping\Driver\AnnotationDriver::class)) { // doctrine/persistence >= 3.0
$config->setLazyGhostObjectEnabled(true);
}

$eventManager = new EventManager();
$entityManager = new EntityManager(DriverManager::getConnection(['driver' => 'pdo_sqlite'], $config, $eventManager), $config, $eventManager);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,9 @@ protected function bootstrapProvider(): DoctrineTokenProvider
$config->setSchemaManagerFactory(new DefaultSchemaManagerFactory());
}

$config->setLazyGhostObjectEnabled(true);
if (!class_exists(\Doctrine\Persistence\Mapping\Driver\AnnotationDriver::class)) { // doctrine/persistence >= 3.0
$config->setLazyGhostObjectEnabled(true);
}

$connection = DriverManager::getConnection([
'driver' => 'pdo_sqlite',
Expand Down
2 changes: 1 addition & 1 deletion src/Symfony/Bridge/Doctrine/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"require": {
"php": ">=8.1",
"doctrine/event-manager": "^1.2|^2",
"doctrine/persistence": "^3.1",
"doctrine/persistence": "^2.5|^3.1",
"symfony/deprecation-contracts": "^2.5|^3",
"symfony/polyfill-ctype": "~1.8",
"symfony/polyfill-mbstring": "~1.0",
Expand Down