File tree Expand file tree Collapse file tree 3 files changed +12
-5
lines changed Expand file tree Collapse file tree 3 files changed +12
-5
lines changed Original file line number Diff line number Diff line change 4
4
5
5
namespace Genkgo \Camt \DTO ;
6
6
7
+ use DateTimeImmutable ;
8
+
7
9
class PrivateIdentification extends Identification
8
10
{
9
- private ?string $ birthDate = null ;
11
+ private ?DateTimeImmutable $ birthDate = null ;
10
12
11
13
private ?string $ provinceOfBirth = null ;
12
14
@@ -20,12 +22,12 @@ class PrivateIdentification extends Identification
20
22
21
23
private ?string $ otherSchemeName = null ;
22
24
23
- public function getBirthDate (): ?string
25
+ public function getBirthDate (): ?DateTimeImmutable
24
26
{
25
27
return $ this ->birthDate ;
26
28
}
27
29
28
- public function setBirthDate (?string $ birthDate ): void
30
+ public function setBirthDate (?DateTimeImmutable $ birthDate ): void
29
31
{
30
32
$ this ->birthDate = $ birthDate ;
31
33
}
Original file line number Diff line number Diff line change 4
4
5
5
namespace Genkgo \Camt \Decoder \Factory \DTO ;
6
6
7
+ use Genkgo \Camt \Decoder \Date ;
7
8
use Genkgo \Camt \DTO ;
8
9
use SimpleXMLElement ;
9
10
@@ -14,7 +15,8 @@ public static function createFromXml(SimpleXMLElement $xmlPrivateIdentification)
14
15
$ privateIdentification = new DTO \PrivateIdentification ();
15
16
if (isset ($ xmlPrivateIdentification ->DtAndPlcOfBirth )) {
16
17
if (isset ($ xmlPrivateIdentification ->DtAndPlcOfBirth ->BirthDt )) {
17
- $ privateIdentification ->setBirthDate ((string ) $ xmlPrivateIdentification ->DtAndPlcOfBirth ->BirthDt );
18
+ $ dateDecoder = new Date ();
19
+ $ privateIdentification ->setBirthDate ($ dateDecoder ->decode ((string ) $ xmlPrivateIdentification ->DtAndPlcOfBirth ->BirthDt ));
18
20
}
19
21
if (isset ($ xmlPrivateIdentification ->DtAndPlcOfBirth ->PrvcOfBirth )) {
20
22
$ privateIdentification ->setProvinceOfBirth ((string ) $ xmlPrivateIdentification ->DtAndPlcOfBirth ->PrvcOfBirth );
Original file line number Diff line number Diff line change 251
251
},
252
252
"getIdentification" : {
253
253
"__CLASS__" : " Genkgo\\ Camt\\ DTO\\ PrivateIdentification" ,
254
- "getBirthDate" : " 1912-12-12" ,
254
+ "getBirthDate" : {
255
+ "__CLASS__" : " DateTimeImmutable" ,
256
+ "0" : " 1912-12-12T00:00:00+00:00"
257
+ },
255
258
"getCityOfBirth" : " Göteborg" ,
256
259
"getCountryOfBirth" : " SE" ,
257
260
"getIdentification" : null ,
You can’t perform that action at this time.
0 commit comments