File tree Expand file tree Collapse file tree
tests/DependencyInjection Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -9,6 +9,11 @@ Configuration
99This option is a no-op when using ` doctrine/orm ` 3 and has been conditionally
1010deprecated. You should stop using it as soon as you upgrade to Doctrine ORM 3.
1111
12+ ### The ` doctrine.dbal.connections.some_connection.disable_type_comments ` configuration option is deprecated
13+
14+ This option is a no-op when using ` doctrine/dbal ` 4 and has been conditionally
15+ deprecated. You should stop using it as soon as you upgrade to Doctrine DBAL 4.
16+
1217ConnectionFactory::createConnection() signature change
1318------------------------------------------------------
1419
Original file line number Diff line number Diff line change 44
55namespace Doctrine \Bundle \DoctrineBundle \DependencyInjection ;
66
7+ use Doctrine \DBAL \Connection ;
78use Doctrine \DBAL \Schema \LegacySchemaManagerFactory ;
89use Doctrine \Deprecations \Deprecation ;
910use Doctrine \ORM \EntityManager ;
@@ -216,7 +217,20 @@ private function getDbalConnectionsNode(): ArrayNodeDefinition
216217 ->defaultValue (true )
217218 ->info ('Enables collecting schema errors when profiling is enabled ' )
218219 ->end ()
219- ->booleanNode ('disable_type_comments ' )->end ()
220+ ->booleanNode ('disable_type_comments ' )
221+ ->beforeNormalization ()
222+ ->ifTrue (static fn ($ v ): bool => isset ($ v ) && ! method_exists (Connection::class, 'getEventManager ' ))
223+ ->then (static function ($ v ) {
224+ Deprecation::trigger (
225+ 'doctrine/doctrine-bundle ' ,
226+ 'https://github.com/doctrine/DoctrineBundle/pull/2048 ' ,
227+ 'The "disable_type_comments" configuration key is deprecated when using DBAL 4 and will be removed in DoctrineBundle 3.0. ' ,
228+ );
229+
230+ return $ v ;
231+ })
232+ ->end ()
233+ ->end ()
220234 ->scalarNode ('server_version ' )->end ()
221235 ->integerNode ('idle_connection_ttl ' )->defaultValue (600 )->end ()
222236 ->scalarNode ('driver_class ' )->end ()
Original file line number Diff line number Diff line change @@ -999,6 +999,27 @@ public function testEnablingReportFieldsWhereDeclaredOnOrm2IsFine(): void
999999 $ this ->loadContainer ('orm_report_fields ' );
10001000 }
10011001
1002+ #[IgnoreDeprecations]
1003+ public function testSettingDisableTypeCommentsWithDbal4IsDeprecated (): void
1004+ {
1005+ if (method_exists (Connection::class, 'getEventManager ' )) {
1006+ self ::markTestSkipped ('This test requires DBAL 4. ' );
1007+ }
1008+
1009+ $ this ->expectDeprecationWithIdentifier ('https://github.com/doctrine/DoctrineBundle/pull/2048 ' );
1010+ $ this ->loadContainer (fixture: 'dbal_disable_type_comments ' , withMinimalOrmConfig: false );
1011+ }
1012+
1013+ public function testSettingDisableTypeCommentsWithDbal3IsFine (): void
1014+ {
1015+ if (! method_exists (Connection::class, 'getEventManager ' )) {
1016+ self ::markTestSkipped ('This test requires DBAL 3. ' );
1017+ }
1018+
1019+ $ this ->expectNoDeprecationWithIdentifier ('https://github.com/doctrine/DoctrineBundle/pull/2048 ' );
1020+ $ this ->loadContainer (fixture: 'dbal_disable_type_comments ' , withMinimalOrmConfig: false );
1021+ }
1022+
10021023 public function testResolveTargetEntity (): void
10031024 {
10041025 if (! interface_exists (EntityManagerInterface::class)) {
You can’t perform that action at this time.
0 commit comments