Skip to content

Commit 395ffc6

Browse files
committed
Merge branch 'hotfix/SUPP0RT-1232-export'
2 parents b4d3427 + 893d0b8 commit 395ffc6

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ Versioning](https://semver.org/spec/v2.0.0.html).
88

99
## [Unreleased]
1010

11+
* [PR-74](https://github.com/itk-dev/kunstdatabasen/pull/74)
12+
Fixed issue with serializing dates
13+
1114
## [1.6.3] - 2023-08-25
1215

1316
* [PR-73](https://github.com/itk-dev/kunstdatabasen/pull/73)

src/Controller/ItemController.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -188,14 +188,16 @@ public function export(string $itemType, EntityManagerInterface $entityManager):
188188
$serializer = new Serializer([new ObjectNormalizer()]);
189189

190190
$dateCallback = function ($innerObject) {
191-
return $innerObject instanceof \DateTime ? $innerObject->format(\DateTime::ATOM) : '';
191+
return $innerObject instanceof \DateTimeInterface ? $innerObject->format(\DateTime::ATOM) : '';
192192
};
193193

194194
$defaultContext = [
195195
AbstractNormalizer::CALLBACKS => [
196196
'createdAt' => $dateCallback,
197197
'updatedAt' => $dateCallback,
198198
'purchaseDate' => $dateCallback,
199+
'locationDate' => $dateCallback,
200+
'assessmentDate' => $dateCallback,
199201
],
200202
AbstractNormalizer::ATTRIBUTES => [
201203
'id',
@@ -244,8 +246,6 @@ public function export(string $itemType, EntityManagerInterface $entityManager):
244246

245247
foreach ($iterableItems as $item) {
246248
$itemArray = $serializer->normalize($item, null, $defaultContext);
247-
// We have a bug!
248-
$itemArray['assessmentDate'] = '';
249249

250250
// Add header in first row.
251251
if (0 === $itemsAdded) {

0 commit comments

Comments
 (0)