Skip to content

Commit f134fec

Browse files
authored
feat: update doctrine bundle configuration and dependencies for compatibility (#766)
1 parent b7bdf8a commit f134fec

File tree

3 files changed

+20
-3
lines changed

3 files changed

+20
-3
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@
9090
},
9191
"require-dev": {
9292
"doctrine/dbal": "^3.8|^4.0",
93-
"doctrine/doctrine-bundle": "^2.12",
93+
"doctrine/doctrine-bundle": "^2.18.1|^3.0",
9494
"doctrine/orm": "^2.14|^3.0",
9595
"doctrine/persistence": "^3.1|^4.0",
9696
"matthiasnoback/symfony-dependency-injection-test": "^5.1|^6.0",

tests/symfony/config/config.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,6 @@ doctrine:
101101

102102
url: '%env(resolve:DATABASE_URL)%'
103103
orm:
104-
enable_lazy_ghost_objects: true
105-
auto_generate_proxy_classes: true
106104
naming_strategy: doctrine.orm.naming_strategy.underscore_number_aware
107105
auto_mapping: true
108106
controller_resolver:

tests/symfony/functional/AppKernel.php

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44

55
namespace Webauthn\Tests\Bundle\Functional;
66

7+
use Composer\InstalledVersions;
8+
use Composer\Semver\VersionParser;
79
use Doctrine\Bundle\DoctrineBundle\DoctrineBundle;
810
use Symfony\Bundle\FrameworkBundle\FrameworkBundle;
911
use Symfony\Bundle\MonologBundle\MonologBundle;
@@ -38,5 +40,22 @@ public function registerBundles(): iterable
3840
public function registerContainerConfiguration(LoaderInterface $loader): void
3941
{
4042
$loader->load(__DIR__ . '/../config/config.yml');
43+
44+
$loader->load(function ($container) {
45+
$isDoctrineBundle2 = InstalledVersions::satisfies(
46+
new VersionParser(),
47+
'doctrine/doctrine-bundle',
48+
'^2.0'
49+
);
50+
51+
if ($isDoctrineBundle2) {
52+
$container->loadFromExtension('doctrine', [
53+
'orm' => [
54+
'enable_lazy_ghost_objects' => true,
55+
'auto_generate_proxy_classes' => true,
56+
],
57+
]);
58+
}
59+
});
4160
}
4261
}

0 commit comments

Comments
 (0)