Skip to content

Commit d7374e6

Browse files
committed
feat: allow doctrine/doctrine-bundle 3
1 parent ae94d0c commit d7374e6

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

tests/Functional/GeocoderListenerTest.php

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,15 @@
2121
use Bazinga\GeocoderBundle\Tests\Functional\Fixtures\Entity\StringableAddress;
2222
use Composer\InstalledVersions;
2323
use Doctrine\Bundle\DoctrineBundle\DoctrineBundle;
24+
use Doctrine\ORM\Configuration;
2425
use Doctrine\ORM\Tools\SchemaTool;
2526
use Nyholm\BundleTest\TestKernel;
2627
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
2728
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
2829
use Symfony\Component\DependencyInjection\ContainerBuilder;
2930
use Symfony\Component\HttpClient\MockHttpClient;
3031
use Symfony\Component\HttpClient\Response\MockResponse;
32+
use Symfony\Component\HttpKernel\Kernel;
3133
use Symfony\Component\HttpKernel\KernelInterface;
3234

3335
/**
@@ -66,17 +68,23 @@ public function process(ContainerBuilder $container): void
6668
});
6769
$kernel->addTestConfig(static function (ContainerBuilder $container) {
6870
$orm = [];
71+
$ormVersion = InstalledVersions::getVersion('doctrine/orm');
6972
// doctrine-bundle
7073
if (null !== $doctrineBundleVersion = InstalledVersions::getVersion('doctrine/doctrine-bundle')) {
7174
// v2
7275
if (version_compare($doctrineBundleVersion, '3.0.0', '<')) {
7376
$orm['auto_generate_proxy_classes'] = true;
74-
$orm['controller_resolver']['auto_mapping'] = true;
77+
$orm['controller_resolver']['auto_mapping'] = false;
78+
$orm['report_fields_where_declared'] = true;
7579
}
76-
if (version_compare($doctrineBundleVersion, '2.8.0', '>=') && version_compare($doctrineBundleVersion, '3.0.0', '<')) {
80+
if (method_exists(Configuration::class, 'setLazyGhostObjectEnabled') && Kernel::VERSION_ID >= 60100) {
7781
$orm['enable_lazy_ghost_objects'] = true;
7882
}
79-
if (\PHP_VERSION_ID >= 80400 && version_compare($doctrineBundleVersion, '2.15.0', '>=') && version_compare($doctrineBundleVersion, '3.1.0', '<')) {
83+
if (\PHP_VERSION_ID >= 80400
84+
&& version_compare($doctrineBundleVersion, '2.15.0', '>=')
85+
&& version_compare($doctrineBundleVersion, '3.1.0', '<')
86+
&& version_compare($ormVersion, '3.4.0', '>=')
87+
) {
8088
$orm['enable_native_lazy_objects'] = true;
8189
}
8290
}

0 commit comments

Comments
 (0)