Skip to content

Commit 01649de

Browse files
committed
Add compatibility with doctrine/doctrine-bundle:^3.0.0
1 parent 7983aa9 commit 01649de

File tree

6 files changed

+34
-28
lines changed

6 files changed

+34
-28
lines changed

src/Autocomplete/composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
},
3434
"require-dev": {
3535
"doctrine/collections": "^1.6.8|^2.0",
36-
"doctrine/doctrine-bundle": "^2.4.3",
36+
"doctrine/doctrine-bundle": "^2.4.3|^3.0.0",
3737
"doctrine/orm": "^2.9.4|^3.0",
3838
"fakerphp/faker": "^1.22",
3939
"mtdowling/jmespath.php": "^2.6",

src/Autocomplete/tests/Fixtures/Kernel.php

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -113,8 +113,6 @@ protected function configureContainer(ContainerConfigurator $c): void
113113
$doctrineConfig = [
114114
'dbal' => ['url' => '%env(resolve:DATABASE_URL)%'],
115115
'orm' => [
116-
'auto_generate_proxy_classes' => true,
117-
'auto_mapping' => true,
118116
'mappings' => [
119117
'Test' => [
120118
'is_bundle' => false,
@@ -126,15 +124,15 @@ protected function configureContainer(ContainerConfigurator $c): void
126124
],
127125
],
128126
];
129-
if (class_exists(AssociationMapping::class)) {
130-
// Doctrine ORM >= 3.0
131-
$doctrineConfig['orm']['controller_resolver'] = [
132-
'auto_mapping' => true,
133-
];
134-
}
127+
135128
if (null !== $doctrineBundleVersion = InstalledVersions::getVersion('doctrine/doctrine-bundle')) {
136-
if (version_compare($doctrineBundleVersion, '2.8.0', '>=')) {
137-
$doctrineConfig['orm']['enable_lazy_ghost_objects'] = true;
129+
if (version_compare($doctrineBundleVersion, '3.0.0', '<')) {
130+
$doctrineConfig['orm']['auto_generate_proxy_classes'] = true;
131+
$doctrineConfig['orm']['controller_resolver']['auto_mapping'] = true;
132+
133+
if (version_compare($doctrineBundleVersion, '2.8.0', '>=')) {
134+
$doctrineConfig['orm']['enable_lazy_ghost_objects'] = true;
135+
}
138136
}
139137
if (\PHP_VERSION_ID >= 80400 && version_compare($doctrineBundleVersion, '2.15.0', '>=')) {
140138
$doctrineConfig['orm']['enable_native_lazy_objects'] = true;

src/LiveComponent/composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
"require-dev": {
3838
"doctrine/annotations": "^1.0|^2.0",
3939
"doctrine/collections": "^1.6.8|^2.0",
40-
"doctrine/doctrine-bundle": "^2.4.3",
40+
"doctrine/doctrine-bundle": "^2.4.3|^3.0.0",
4141
"doctrine/orm": "^2.9.4|^3.0",
4242
"doctrine/persistence": "^2.5.2|^3.0",
4343
"phpdocumentor/reflection-docblock": "5.x-dev",

src/LiveComponent/tests/Fixtures/Kernel.php

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -162,8 +162,6 @@ protected function configureContainer(ContainerConfigurator $c): void
162162
'url' => '%env(resolve:DATABASE_URL)%',
163163
],
164164
'orm' => [
165-
'auto_generate_proxy_classes' => true,
166-
'auto_mapping' => true,
167165
'mappings' => [
168166
'Default' => [
169167
'is_bundle' => false,
@@ -184,18 +182,24 @@ protected function configureContainer(ContainerConfigurator $c): void
184182
];
185183

186184
if (null !== $doctrineBundleVersion = InstalledVersions::getVersion('doctrine/doctrine-bundle')) {
187-
if (version_compare($doctrineBundleVersion, '2.8.0', '>=')) {
188-
$doctrineConfig['orm']['enable_lazy_ghost_objects'] = true;
185+
if (version_compare($doctrineBundleVersion, '3.0.0', '<')) {
186+
$doctrineConfig['orm']['auto_generate_proxy_classes'] = true;
187+
$doctrineConfig['orm']['controller_resolver']['auto_mapping'] = true;
188+
189+
if (version_compare($doctrineBundleVersion, '2.8.0', '>=')) {
190+
$doctrineConfig['orm']['enable_lazy_ghost_objects'] = true;
191+
}
192+
if (version_compare($doctrineBundleVersion, '2.12.0', '>=')) {
193+
$doctrineConfig['orm']['controller_resolver']['auto_mapping'] = false;
194+
}
189195
}
196+
190197
// https://github.com/doctrine/DoctrineBundle/pull/1661
191198
if (version_compare($doctrineBundleVersion, '2.9.0', '>=')) {
192199
$doctrineConfig['orm']['report_fields_where_declared'] = true;
193200
$doctrineConfig['orm']['validate_xml_mapping'] = true;
194201
$doctrineConfig['dbal']['schema_manager_factory'] = 'doctrine.dbal.default_schema_manager_factory';
195202
}
196-
if (version_compare($doctrineBundleVersion, '2.12.0', '>=')) {
197-
$doctrineConfig['orm']['controller_resolver']['auto_mapping'] = false;
198-
}
199203
if (\PHP_VERSION_ID >= 80400 && version_compare($doctrineBundleVersion, '2.15.0', '>=')) {
200204
$doctrineConfig['orm']['enable_native_lazy_objects'] = true;
201205
}

src/Turbo/composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
"symfony/stimulus-bundle": "^2.9.1"
3939
},
4040
"require-dev": {
41-
"doctrine/doctrine-bundle": "^2.4.3",
41+
"doctrine/doctrine-bundle": "^2.4.3|^3.0.0",
4242
"doctrine/orm": "^2.8|^3.0",
4343
"phpstan/phpstan": "^2.1.17",
4444
"symfony/asset-mapper": "^6.4|^7.0|^8.0",

src/Turbo/tests/app/Kernel.php

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,6 @@ protected function configureContainer(ContainerConfigurator $container): void
8484
'url' => 'sqlite:///%kernel.project_dir%/var/turbo.db',
8585
],
8686
'orm' => [
87-
'auto_generate_proxy_classes' => true,
88-
'auto_mapping' => true,
8987
'mappings' => [
9088
'App' => [
9189
'is_bundle' => false,
@@ -99,12 +97,18 @@ protected function configureContainer(ContainerConfigurator $container): void
9997
];
10098

10199
if (null !== $doctrineBundleVersion = InstalledVersions::getVersion('doctrine/doctrine-bundle')) {
102-
if (version_compare($doctrineBundleVersion, '2.8.0', '>=')) {
103-
$doctrineConfig['orm']['enable_lazy_ghost_objects'] = true;
104-
}
105-
// https://github.com/doctrine/DoctrineBundle/pull/1661
106-
if (version_compare($doctrineBundleVersion, '2.9.0', '>=')) {
107-
$doctrineConfig['orm']['report_fields_where_declared'] = true;
100+
if (version_compare($doctrineBundleVersion, '3.0.0', '<')) {
101+
$doctrineConfig['orm']['auto_generate_proxy_classes'] = true;
102+
$doctrineConfig['orm']['controller_resolver']['auto_mapping'] = true;
103+
104+
if (version_compare($doctrineBundleVersion, '2.8.0', '>=')) {
105+
$doctrineConfig['orm']['enable_lazy_ghost_objects'] = true;
106+
}
107+
108+
// https://github.com/doctrine/DoctrineBundle/pull/1661
109+
if (version_compare($doctrineBundleVersion, '2.9.0', '>=')) {
110+
$doctrineConfig['orm']['report_fields_where_declared'] = true;
111+
}
108112
}
109113

110114
if (\PHP_VERSION_ID >= 80400 && version_compare($doctrineBundleVersion, '2.15.0', '>=')) {

0 commit comments

Comments
 (0)