Skip to content

Commit

Permalink
fix(Setting): Always format DateTimeInterface to string in settings e…
Browse files Browse the repository at this point in the history
…ven if type is wrongly set
  • Loading branch information
ambroisemaupate committed Mar 19, 2024
1 parent 9231f42 commit 3c9eda6
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions lib/RoadizCoreBundle/src/Entity/Setting.php
Original file line number Diff line number Diff line change
Expand Up @@ -189,10 +189,7 @@ public function setValue(mixed $value): self
{
if (null === $value) {
$this->value = null;
} elseif (
($this->getType() === AbstractField::DATETIME_T || $this->getType() === AbstractField::DATE_T) &&
$value instanceof \DateTimeInterface
) {
} elseif ($value instanceof \DateTimeInterface) {
$this->value = $value->format('c'); // $value is instance of \DateTime
} else {
$this->value = (string) $value;
Expand Down

0 comments on commit 3c9eda6

Please sign in to comment.