File tree Expand file tree Collapse file tree 4 files changed +5
-9
lines changed
src/Symfony/Bridge/Doctrine
DependencyInjection/CompilerPass Expand file tree Collapse file tree 4 files changed +5
-9
lines changed Original file line number Diff line number Diff line change @@ -5,12 +5,12 @@ CHANGELOG
55---
66
77 * Reset the manager registry using native lazy objects when applicable
8+ * Add support for ` Symfony\Component\Clock\DatePoint ` as ` DatePointType ` Doctrine type
89
9107.2
1011---
1112
1213 * Accept ` ReadableCollection ` in ` CollectionToArrayTransformer `
13- * Add support for ` Symfony\Component\Clock\DatePoint ` as ` DatePointType ` Doctrine type
1414
15157.1
1616---
Original file line number Diff line number Diff line change @@ -28,12 +28,10 @@ public function process(ContainerBuilder $container): void
2828 return ;
2929 }
3030
31- $ typeDefinition = $ container ->getParameter ('doctrine.dbal.connection_factory.types ' );
31+ $ types = $ container ->getParameter ('doctrine.dbal.connection_factory.types ' );
3232
33- if (is_array ($ typeDefinition ) && !isset ($ typeDefinition ['date_point ' ])) {
34- $ typeDefinition ['date_point ' ] = ['class ' => DatePointType::class];
35- }
33+ $ types ['date_point ' ] ??= ['class ' => DatePointType::class];
3634
37- $ container ->setParameter ('doctrine.dbal.connection_factory.types ' , $ typeDefinition );
35+ $ container ->setParameter ('doctrine.dbal.connection_factory.types ' , $ types );
3836 }
3937}
Original file line number Diff line number Diff line change 1111
1212namespace Symfony \Bridge \Doctrine \Tests \Types ;
1313
14- use DateTimeImmutable ;
1514use Doctrine \DBAL \Platforms \AbstractPlatform ;
1615use Doctrine \DBAL \Platforms \MariaDBPlatform ;
1716use Doctrine \DBAL \Platforms \PostgreSQLPlatform ;
@@ -72,7 +71,7 @@ public function testNullConvertsToPHPValue()
7271 public function testDateTimeImmutableConvertsToPHPValue ()
7372 {
7473 $ format = 'Y-m-d H:i:s ' ;
75- $ dateTime = new DateTimeImmutable ('2025-03-03 12:13:14 ' );
74+ $ dateTime = new \ DateTimeImmutable ('2025-03-03 12:13:14 ' );
7675 $ actual = $ this ->type ->convertToPHPValue ($ dateTime , new SqlitePlatform ());
7776 $ expected = DatePoint::createFromInterface ($ dateTime );
7877
Original file line number Diff line number Diff line change 1111
1212namespace Symfony \Bridge \Doctrine \Types ;
1313
14- use DateTimeInterface ;
1514use Doctrine \DBAL \Platforms \AbstractPlatform ;
1615use Doctrine \DBAL \Types \DateTimeImmutableType ;
1716use Symfony \Component \Clock \DatePoint ;
You can’t perform that action at this time.
0 commit comments