From 0bd1570c4dd72e51a5fbcab75199cd15e61da2f5 Mon Sep 17 00:00:00 2001 From: BacLuc Date: Sat, 5 Aug 2023 19:51:42 +0200 Subject: [PATCH] CategoryCreateProcessor: set timestampable properties manually In production this does not work in this case now. Because reproduction and fix may be hard, we use this quickfix here. This allows us to release and deploy in the meantime. Issue: #3662 --- api/src/Entity/ContentNode/ColumnLayout.php | 10 ++++++++++ api/src/State/CategoryCreateProcessor.php | 8 ++++++++ 2 files changed, 18 insertions(+) diff --git a/api/src/Entity/ContentNode/ColumnLayout.php b/api/src/Entity/ContentNode/ColumnLayout.php index 59532e71d4c..ffdca823f79 100644 --- a/api/src/Entity/ContentNode/ColumnLayout.php +++ b/api/src/Entity/ContentNode/ColumnLayout.php @@ -138,4 +138,14 @@ public function getSupportedSlotNames(): array { return $columns->map(fn (array $element) => $element['slot'])->getValues(); } + + #[ApiProperty(readable: false, writable: false)] + public function setCreateTime(\DateTime $createTime): void { + $this->createTime = $createTime; + } + + #[ApiProperty(readable: false, writable: false)] + public function setUpdateTime(\DateTime $updateTime): void { + $this->updateTime = $updateTime; + } } diff --git a/api/src/State/CategoryCreateProcessor.php b/api/src/State/CategoryCreateProcessor.php index b7ff4cc41f5..66aec1af57e 100644 --- a/api/src/State/CategoryCreateProcessor.php +++ b/api/src/State/CategoryCreateProcessor.php @@ -30,6 +30,14 @@ public function onBefore($data, Operation $operation, array $uriVariables = [], ->findOneBy(['name' => 'ColumnLayout']) ; $rootContentNode->data = ['columns' => [['slot' => '1', 'width' => 12]]]; + /* + * Set the timestampable properties here by hand, because only in production + * this does not work. + * Remove this again as soon as https://github.com/ecamp/ecamp3/issues/3662 is really fixed. + */ + $rootContentNode->setCreateTime(new \DateTime()); + $rootContentNode->setUpdateTime(new \DateTime()); + $data->setRootContentNode($rootContentNode); return $data;