Skip to content

Commit fa9b044

Browse files
Spomkyclaude
andcommitted
fix: conditionally configure Doctrine ORM options based on doctrine-bundle version
Add version-specific Doctrine ORM configuration in AppKernel to support both doctrine-bundle 2.x and 3.x: - For doctrine-bundle 2.x (< 3.0): Set enable_lazy_ghost_objects and auto_generate_proxy_classes - For doctrine-bundle 3.x (>= 3.0): These options are deprecated/removed and should not be set This fixes compatibility issues when running tests with different doctrine-bundle versions. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent b7bdf8a commit fa9b044

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

tests/symfony/functional/AppKernel.php

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,5 +38,22 @@ public function registerBundles(): iterable
3838
public function registerContainerConfiguration(LoaderInterface $loader): void
3939
{
4040
$loader->load(__DIR__ . '/../config/config.yml');
41+
42+
// Add Doctrine ORM configuration based on doctrine-bundle version
43+
$loader->load(function ($container) {
44+
// Check doctrine/doctrine-bundle version
45+
$isDoctrine2 = version_compare(DoctrineBundle::VERSION, '3.0', '<');
46+
47+
if ($isDoctrine2) {
48+
// For doctrine-bundle 2.x, these options are required
49+
$container->loadFromExtension('doctrine', [
50+
'orm' => [
51+
'enable_lazy_ghost_objects' => true,
52+
'auto_generate_proxy_classes' => true,
53+
],
54+
]);
55+
}
56+
// For doctrine-bundle 3.x, these options should not be set (they're deprecated/removed)
57+
});
4158
}
4259
}

0 commit comments

Comments
 (0)