55namespace Meilisearch \Bundle \Tests ;
66
77use Doctrine \Bundle \DoctrineBundle \ConnectionFactory ;
8+ use Doctrine \Bundle \DoctrineBundle \Dbal \BlacklistSchemaAssetFilter ;
89use Doctrine \Bundle \DoctrineBundle \DoctrineBundle ;
9- use Doctrine \ORM \Configuration ;
1010use Doctrine \ORM \Mapping \LegacyReflectionFields ;
1111use Meilisearch \Bundle \MeilisearchBundle ;
1212use Symfony \Bridge \Doctrine \ArgumentResolver \EntityValueResolver ;
@@ -29,18 +29,30 @@ public function registerBundles(): iterable
2929
3030 protected function configureContainer (ContainerBuilder $ container , LoaderInterface $ loader ): void
3131 {
32+ $ loader ->load (__DIR__ .'/config/framework.yaml ' );
33+
34+ $ doctrineBundleV3 = !class_exists (BlacklistSchemaAssetFilter::class);
35+
3236 if (PHP_VERSION_ID >= 80000 ) {
33- if (class_exists (LegacyReflectionFields::class) && PHP_VERSION_ID >= 80400 ) {
34- $ loader ->load (__DIR__ .'/config/config.yaml ' );
37+ if ($ doctrineBundleV3 ) {
38+ $ loader ->load (__DIR__ .'/config/doctrine.yaml ' );
39+ } elseif (class_exists (LegacyReflectionFields::class) && PHP_VERSION_ID >= 80400 ) {
40+ $ loader ->load (__DIR__ .'/config/doctrine_v2.yaml ' );
3541 } else {
36- $ loader ->load (__DIR__ .'/config/config_old_proxy .yaml ' );
42+ $ loader ->load (__DIR__ .'/config/doctrine_old_proxy .yaml ' );
3743 }
3844 } else {
39- $ loader ->load (__DIR__ .'/config/config_php7.yaml ' );
45+ $ container ->prependExtensionConfig ('framework ' , [
46+ 'annotations ' => true ,
47+ 'serializer ' => ['enable_annotations ' => true ],
48+ 'router ' => ['utf8 ' => true ],
49+ ]);
50+
51+ $ loader ->load (__DIR__ .'/config/doctrine_php7.yaml ' );
4052 }
4153 $ loader ->load (__DIR__ .'/config/meilisearch.yaml ' );
4254
43- if (\defined (ConnectionFactory::class.'::DEFAULT_SCHEME_MAP ' )) {
55+ if (\defined (ConnectionFactory::class.'::DEFAULT_SCHEME_MAP ' ) && ! $ doctrineBundleV3 ) {
4456 $ container ->prependExtensionConfig ('doctrine ' , [
4557 'orm ' => [
4658 'report_fields_where_declared ' => true ,
@@ -49,15 +61,6 @@ protected function configureContainer(ContainerBuilder $container, LoaderInterfa
4961 ]);
5062 }
5163
52- // @phpstan-ignore-next-line
53- if (method_exists (Configuration::class, 'setLazyGhostObjectEnabled ' ) && Kernel::VERSION_ID >= 60100 ) {
54- $ container ->prependExtensionConfig ('doctrine ' , [
55- 'orm ' => [
56- 'enable_lazy_ghost_objects ' => true ,
57- ],
58- ]);
59- }
60-
6164 if (class_exists (EntityValueResolver::class)) {
6265 $ container ->prependExtensionConfig ('doctrine ' , [
6366 'orm ' => [
0 commit comments