|
21 | 21 | use Bazinga\GeocoderBundle\Tests\Functional\Fixtures\Entity\StringableAddress; |
22 | 22 | use Composer\InstalledVersions; |
23 | 23 | use Doctrine\Bundle\DoctrineBundle\DoctrineBundle; |
| 24 | +use Doctrine\ORM\Configuration; |
24 | 25 | use Doctrine\ORM\Tools\SchemaTool; |
25 | 26 | use Nyholm\BundleTest\TestKernel; |
26 | 27 | use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase; |
27 | 28 | use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface; |
28 | 29 | use Symfony\Component\DependencyInjection\ContainerBuilder; |
29 | 30 | use Symfony\Component\HttpClient\MockHttpClient; |
30 | 31 | use Symfony\Component\HttpClient\Response\MockResponse; |
| 32 | +use Symfony\Component\HttpKernel\Kernel; |
31 | 33 | use Symfony\Component\HttpKernel\KernelInterface; |
32 | 34 |
|
33 | 35 | /** |
@@ -66,17 +68,23 @@ public function process(ContainerBuilder $container): void |
66 | 68 | }); |
67 | 69 | $kernel->addTestConfig(static function (ContainerBuilder $container) { |
68 | 70 | $orm = []; |
| 71 | + $ormVersion = InstalledVersions::getVersion('doctrine/orm'); |
69 | 72 | // doctrine-bundle |
70 | 73 | if (null !== $doctrineBundleVersion = InstalledVersions::getVersion('doctrine/doctrine-bundle')) { |
71 | 74 | // v2 |
72 | 75 | if (version_compare($doctrineBundleVersion, '3.0.0', '<')) { |
73 | 76 | $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; |
75 | 79 | } |
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) { |
77 | 81 | $orm['enable_lazy_ghost_objects'] = true; |
78 | 82 | } |
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 | + ) { |
80 | 88 | $orm['enable_native_lazy_objects'] = true; |
81 | 89 | } |
82 | 90 | } |
|
0 commit comments