File tree 4 files changed +5
-9
lines changed
src/Symfony/Bridge/Doctrine
DependencyInjection/CompilerPass
4 files changed +5
-9
lines changed Original file line number Diff line number Diff line change @@ -5,12 +5,12 @@ CHANGELOG
5
5
---
6
6
7
7
* Reset the manager registry using native lazy objects when applicable
8
+ * Add support for ` Symfony\Component\Clock\DatePoint ` as ` DatePointType ` Doctrine type
8
9
9
10
7.2
10
11
---
11
12
12
13
* Accept ` ReadableCollection ` in ` CollectionToArrayTransformer `
13
- * Add support for ` Symfony\Component\Clock\DatePoint ` as ` DatePointType ` Doctrine type
14
14
15
15
7.1
16
16
---
Original file line number Diff line number Diff line change @@ -28,12 +28,10 @@ public function process(ContainerBuilder $container): void
28
28
return ;
29
29
}
30
30
31
- $ typeDefinition = $ container ->getParameter ('doctrine.dbal.connection_factory.types ' );
31
+ $ types = $ container ->getParameter ('doctrine.dbal.connection_factory.types ' );
32
32
33
- if (is_array ($ typeDefinition ) && !isset ($ typeDefinition ['date_point ' ])) {
34
- $ typeDefinition ['date_point ' ] = ['class ' => DatePointType::class];
35
- }
33
+ $ types ['date_point ' ] ??= ['class ' => DatePointType::class];
36
34
37
- $ container ->setParameter ('doctrine.dbal.connection_factory.types ' , $ typeDefinition );
35
+ $ container ->setParameter ('doctrine.dbal.connection_factory.types ' , $ types );
38
36
}
39
37
}
Original file line number Diff line number Diff line change 11
11
12
12
namespace Symfony \Bridge \Doctrine \Tests \Types ;
13
13
14
- use DateTimeImmutable ;
15
14
use Doctrine \DBAL \Platforms \AbstractPlatform ;
16
15
use Doctrine \DBAL \Platforms \MariaDBPlatform ;
17
16
use Doctrine \DBAL \Platforms \PostgreSQLPlatform ;
@@ -72,7 +71,7 @@ public function testNullConvertsToPHPValue()
72
71
public function testDateTimeImmutableConvertsToPHPValue ()
73
72
{
74
73
$ 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 ' );
76
75
$ actual = $ this ->type ->convertToPHPValue ($ dateTime , new SqlitePlatform ());
77
76
$ expected = DatePoint::createFromInterface ($ dateTime );
78
77
Original file line number Diff line number Diff line change 11
11
12
12
namespace Symfony \Bridge \Doctrine \Types ;
13
13
14
- use DateTimeInterface ;
15
14
use Doctrine \DBAL \Platforms \AbstractPlatform ;
16
15
use Doctrine \DBAL \Types \DateTimeImmutableType ;
17
16
use Symfony \Component \Clock \DatePoint ;
You can’t perform that action at this time.
0 commit comments