Skip to content

Commit

Permalink
CategoryCreateProcessor: set timestampable properties manually
Browse files Browse the repository at this point in the history
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: ecamp#3662
  • Loading branch information
BacLuc committed Aug 5, 2023
1 parent 5585942 commit 0bd1570
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
10 changes: 10 additions & 0 deletions api/src/Entity/ContentNode/ColumnLayout.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
8 changes: 8 additions & 0 deletions api/src/State/CategoryCreateProcessor.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 0bd1570

Please sign in to comment.