From e84eb912038c3415b6b99292002d32e50067af40 Mon Sep 17 00:00:00 2001 From: Sergei Predvoditelev Date: Sat, 19 Jul 2025 14:11:07 +0300 Subject: [PATCH 1/3] Adapt to removing `ParamInterface` from `yiisoft/db` package --- CHANGELOG.md | 1 + src/Column/BinaryColumn.php | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c92055e6..1aff2a22 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -52,6 +52,7 @@ - Enh #327: Refactor constraints (@Tigrov) - Chg #330: Rename `insertWithReturningPks()` to `insertReturningPks()` in `Command` and `DMLQueryBuilder` classes (@Tigrov) - Enh #336: Provide `yiisoft/db-implementation` virtual package (@vjik) +- Enh #340: Adapt to removing `ParamInterface` from `yiisoft/db` package (@vjik) ## 1.3.0 March 21, 2024 diff --git a/src/Column/BinaryColumn.php b/src/Column/BinaryColumn.php index 3b958549..8177414e 100644 --- a/src/Column/BinaryColumn.php +++ b/src/Column/BinaryColumn.php @@ -4,7 +4,7 @@ namespace Yiisoft\Db\Oracle\Column; -use Yiisoft\Db\Command\ParamInterface; +use Yiisoft\Db\Command\Param; use Yiisoft\Db\Expression\Expression; use Yiisoft\Db\Schema\Column\BinaryColumn as BaseBinaryColumn; @@ -15,7 +15,7 @@ final class BinaryColumn extends BaseBinaryColumn public function dbTypecast(mixed $value): mixed { if ($this->getDbType() === 'blob') { - if ($value instanceof ParamInterface && is_string($value->getValue())) { + if ($value instanceof Param && is_string($value->getValue())) { /** @var string */ $value = $value->getValue(); } From 4cdc714542954824cc28d9828368f71d1856ef4b Mon Sep 17 00:00:00 2001 From: Sergei Predvoditelev Date: Sat, 19 Jul 2025 14:19:14 +0300 Subject: [PATCH 2/3] fix --- CHANGELOG.md | 2 +- src/Column/BinaryColumn.php | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1aff2a22..ac378c19 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -52,7 +52,7 @@ - Enh #327: Refactor constraints (@Tigrov) - Chg #330: Rename `insertWithReturningPks()` to `insertReturningPks()` in `Command` and `DMLQueryBuilder` classes (@Tigrov) - Enh #336: Provide `yiisoft/db-implementation` virtual package (@vjik) -- Enh #340: Adapt to removing `ParamInterface` from `yiisoft/db` package (@vjik) +- Enh #340: Adapt to `Param` refactoring in `yiisoft/db` package (@vjik) ## 1.3.0 March 21, 2024 diff --git a/src/Column/BinaryColumn.php b/src/Column/BinaryColumn.php index 8177414e..534ef17d 100644 --- a/src/Column/BinaryColumn.php +++ b/src/Column/BinaryColumn.php @@ -15,9 +15,8 @@ final class BinaryColumn extends BaseBinaryColumn public function dbTypecast(mixed $value): mixed { if ($this->getDbType() === 'blob') { - if ($value instanceof Param && is_string($value->getValue())) { - /** @var string */ - $value = $value->getValue(); + if ($value instanceof Param && is_string($value->value)) { + $value = $value->value; } if (is_string($value)) { From ecb106a8c15b49d57240ebd8583574fa7acb25f3 Mon Sep 17 00:00:00 2001 From: Sergei Predvoditelev Date: Sat, 19 Jul 2025 14:33:04 +0300 Subject: [PATCH 3/3] fix --- src/Command.php | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/src/Command.php b/src/Command.php index df637519..7a70fbcb 100644 --- a/src/Command.php +++ b/src/Command.php @@ -114,21 +114,17 @@ public function showDatabases(): array protected function bindPendingParams(): void { $paramsPassedByReference = []; - - $params = $this->params; - - foreach ($params as $name => $value) { - if (PDO::PARAM_STR === $value->getType()) { - /** @var mixed */ - $paramsPassedByReference[$name] = $value->getValue(); + foreach ($this->params as $name => $param) { + if (PDO::PARAM_STR === $param->type) { + $paramsPassedByReference[$name] = $param->value; $this->pdoStatement?->bindParam( $name, $paramsPassedByReference[$name], - $value->getType(), - strlen((string) $value->getValue()) + $param->type, + strlen((string) $param->value) ); } else { - $this->pdoStatement?->bindValue($name, $value->getValue(), $value->getType()); + $this->pdoStatement?->bindValue($name, $param->value, $param->type); } } }