From 3dcb139143aeb414b90a45c5cf3524a5bfbd1aca Mon Sep 17 00:00:00 2001 From: "Nikola Svitlica a.k.a TheCelavi" Date: Thu, 15 Aug 2024 16:28:06 +0200 Subject: [PATCH] Fixed DbalParams and immutable dates --- CHANGELOG.md | 9 ++++++++- .../Executor/Dbal/DbalParameters.php | 8 ++++---- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 322cba0..f2422ef 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,11 +7,18 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/)and this pr ## Changelog +## [8.0.2] - 2024-08-15 + +### Fixed + +- Fixed setting immutable date params with mutable date in + `RunOpenCode\Bundle\QueryResourcesLoader\Executor\Dbal\DbalParameters`. + ## [8.0.1] - 2024-08-15 ### Fixed -- Fixed nullability of array parameters of `RunOpenCode\Bundle\QueryResourcesLoader\Executor\Dbal\DbalParameters`. +- Fixed nullability of array parameters of `RunOpenCode\Bundle\QueryResourcesLoader\Executor\Dbal\DbalParameters`. ## [8.0.0] - 2024-08-14 diff --git a/src/RunOpenCode/Bundle/QueryResourcesLoader/Executor/Dbal/DbalParameters.php b/src/RunOpenCode/Bundle/QueryResourcesLoader/Executor/Dbal/DbalParameters.php index f214999..8134b96 100644 --- a/src/RunOpenCode/Bundle/QueryResourcesLoader/Executor/Dbal/DbalParameters.php +++ b/src/RunOpenCode/Bundle/QueryResourcesLoader/Executor/Dbal/DbalParameters.php @@ -75,7 +75,7 @@ final public function date(string $name, ?\DateTimeInterface $value): self final public function dateImmutable(string $name, ?\DateTimeInterface $value): self { - $value = null !== $value && !$value instanceof \DateTimeImmutable ? \DateTimeImmutable::createFromInterface($value) : null; + $value = null !== $value && !$value instanceof \DateTimeImmutable ? \DateTimeImmutable::createFromInterface($value) : $value; return $this->set($name, $value, Types::DATE_IMMUTABLE); } @@ -92,7 +92,7 @@ final public function dateTime(string $name, ?\DateTimeInterface $value): self final public function dateTimeImmutable(string $name, ?\DateTimeInterface $value): self { - $value = null !== $value && !$value instanceof \DateTimeImmutable ? \DateTimeImmutable::createFromInterface($value) : null; + $value = null !== $value && !$value instanceof \DateTimeImmutable ? \DateTimeImmutable::createFromInterface($value) : $value; return $this->set($name, $value, Types::DATETIME_IMMUTABLE); } @@ -104,7 +104,7 @@ final public function dateTimeTz(string $name, ?\DateTimeInterface $value): self final public function dateTimeTzImmutable(string $name, ?\DateTimeInterface $value): self { - $value = null !== $value && !$value instanceof \DateTimeImmutable ? \DateTimeImmutable::createFromInterface($value) : null; + $value = null !== $value && !$value instanceof \DateTimeImmutable ? \DateTimeImmutable::createFromInterface($value) : $value; return $this->set($name, $value, Types::DATETIMETZ_IMMUTABLE); } @@ -171,7 +171,7 @@ final public function time(string $name, ?\DateTimeInterface $value): self final public function timeImmutable(string $name, ?\DateTimeInterface $value): self { - $value = null !== $value && !$value instanceof \DateTimeImmutable ? \DateTimeImmutable::createFromInterface($value) : null; + $value = null !== $value && !$value instanceof \DateTimeImmutable ? \DateTimeImmutable::createFromInterface($value) : $value; return $this->set($name, $value, Types::TIME_IMMUTABLE); }