88use Doctrine \Bundle \DoctrineBundle \DoctrineBundle ;
99use Doctrine \ORM \Configuration ;
1010use Doctrine \ORM \Mapping \LegacyReflectionFields ;
11+ use Doctrine \Bundle \DoctrineBundle \Dbal \BlacklistSchemaAssetFilter ;
1112use Meilisearch \Bundle \MeilisearchBundle ;
1213use Symfony \Bridge \Doctrine \ArgumentResolver \EntityValueResolver ;
1314use Symfony \Bundle \FrameworkBundle \FrameworkBundle ;
@@ -29,44 +30,63 @@ public function registerBundles(): iterable
2930
3031 protected function configureContainer (ContainerBuilder $ container , LoaderInterface $ loader ): void
3132 {
33+ $ loader ->load (__DIR__ .'/config/framework.yaml ' );
34+
35+ $ doctrineBundleV3 = !class_exists (BlacklistSchemaAssetFilter::class);
36+
3237 if (PHP_VERSION_ID >= 80000 ) {
33- if (class_exists (LegacyReflectionFields::class) && PHP_VERSION_ID >= 80400 ) {
38+ if ($ doctrineBundleV3 ) {
3439 $ loader ->load (__DIR__ .'/config/config.yaml ' );
40+ } elseif (class_exists (LegacyReflectionFields::class) && PHP_VERSION_ID >= 80400 ) {
41+ $ loader ->load (__DIR__ .'/config/config_doctrine_v2.yaml ' );
3542 } else {
3643 $ loader ->load (__DIR__ .'/config/config_old_proxy.yaml ' );
3744 }
3845 } else {
39- $ loader ->load (__DIR__ .'/config/config_php7.yaml ' );
40- }
41- $ loader ->load (__DIR__ .'/config/meilisearch.yaml ' );
42-
43- if (\defined (ConnectionFactory::class.'::DEFAULT_SCHEME_MAP ' )) {
44- $ container ->prependExtensionConfig ('doctrine ' , [
45- 'orm ' => [
46- 'report_fields_where_declared ' => true ,
47- 'validate_xml_mapping ' => true ,
48- ],
46+ $ container ->prependExtensionConfig ('framework ' , [
47+ 'annotations ' => true ,
48+ 'serializer ' => ['enable_annotations ' => true ],
49+ 'router ' => ['utf8 ' => true ],
4950 ]);
50- }
5151
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- }
52+ $ loader ->load (__DIR__ .'/config/doctrine_php7.yaml ' );
6053
61- if (class_exists (EntityValueResolver ::class)) {
62- $ container ->prependExtensionConfig ('doctrine ' , [
63- 'orm ' => [
64- ' controller_resolver ' => [
65- 'auto_mapping ' => false ,
54+ if (\defined (ConnectionFactory ::class. ' ::DEFAULT_SCHEME_MAP ' )) {
55+ $ container ->prependExtensionConfig ('doctrine ' , [
56+ 'orm ' => [
57+ ' report_fields_where_declared ' => true ,
58+ 'validate_xml_mapping ' => true ,
6659 ],
67- ],
68- ]);
60+ ]);
61+ }
6962 }
63+ $ loader ->load (__DIR__ .'/config/meilisearch.yaml ' );
64+
65+ $ doctrineBundleV3 = !class_exists (BlacklistSchemaAssetFilter::class);
66+
67+ // if (!class_exists(BlacklistSchemaAssetFilter::class)) {
68+ // $container->prependExtensionConfig('doctrine', [
69+ // 'orm' => [
70+ // 'enable_native_lazy_objects' => true,
71+ // ],
72+ // ]);
73+ // } elseif (method_exists(Configuration::class, 'setLazyGhostObjectEnabled') && Kernel::VERSION_ID >= 60100 && !$doctrineBundleV3) {
74+ // $container->prependExtensionConfig('doctrine', [
75+ // 'orm' => [
76+ // 'enable_lazy_ghost_objects' => true,
77+ // ],
78+ // ]);
79+ // }
80+
81+ // if (class_exists(EntityValueResolver::class)) {
82+ // $container->prependExtensionConfig('doctrine', [
83+ // 'orm' => [
84+ // 'controller_resolver' => [
85+ // 'auto_mapping' => false,
86+ // ],
87+ // ],
88+ // ]);
89+ // }
7090
7191 // @phpstan-ignore-next-line
7292 if (Kernel::VERSION_ID >= 60400 ) {
0 commit comments