From ca37aa175f61f3d6010f60096a9d1e9148947630 Mon Sep 17 00:00:00 2001 From: Sergei Tigrov Date: Fri, 10 May 2024 15:11:29 +0700 Subject: [PATCH] Remove `AbstractSchema::normalizeRowKeyCase()` method (#845) --- CHANGELOG.md | 1 + UPGRADE.md | 1 + src/Schema/AbstractSchema.php | 22 ---------------------- tests/Db/Schema/SchemaTest.php | 19 ------------------- 4 files changed, 2 insertions(+), 41 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 91186d070..e6a38681e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -23,6 +23,7 @@ and `AbstractPdoCommand::internalExecute()` method (@Tigrov) - Enh #842: Allow `ExpressionInterface` for `$alias` parameter of `QueryPartsInterface::withQuery()` method (@Tigrov) - Enh #843: Remove `AbstractPdoCommand::logQuery()` method (@Tigrov) +- Chg #845: Remove `AbstractSchema::normalizeRowKeyCase()` method (@Tigrov) ## 1.3.0 March 21, 2024 diff --git a/UPGRADE.md b/UPGRADE.md index ca227c8e7..b25882c84 100644 --- a/UPGRADE.md +++ b/UPGRADE.md @@ -65,6 +65,7 @@ $db->createCommand()->insertBatch('user', $values)->execute(); - `AbstractDMLQueryBuilder::getTypecastValue()` - `TableSchemaInterface::compositeForeignKey()` +- `AbstractSchema::normalizeRowKeyCase()` - `Quoter::unquoteParts()` - `AbstractPdoCommand::logQuery()` diff --git a/src/Schema/AbstractSchema.php b/src/Schema/AbstractSchema.php index 7e13c88f0..54915a9bf 100644 --- a/src/Schema/AbstractSchema.php +++ b/src/Schema/AbstractSchema.php @@ -13,8 +13,6 @@ use Yiisoft\Db\Constraint\IndexConstraint; use Yiisoft\Db\Exception\NotSupportedException; -use function array_change_key_case; -use function array_map; use function gettype; use function is_array; use function preg_match; @@ -529,26 +527,6 @@ protected function getTableTypeMetadata( }; } - /** - * Change row's array key case to lower. - * - * @param array $row Thew row's array or an array of row arrays. - * @param bool $multiple Whether many rows or a single row passed. - * - * @return array The normalized row or rows. - * - * @deprecated Use `array_change_key_case($row)` or `array_map('array_change_key_case', $row)`. - * Will be removed in version 2.0.0. - */ - protected function normalizeRowKeyCase(array $row, bool $multiple): array - { - if ($multiple) { - return array_map(static fn (array $row) => array_change_key_case($row), $row); - } - - return array_change_key_case($row); - } - /** * Resolves the table name and schema name (if any). * diff --git a/tests/Db/Schema/SchemaTest.php b/tests/Db/Schema/SchemaTest.php index 7db253b30..cfd480b8f 100644 --- a/tests/Db/Schema/SchemaTest.php +++ b/tests/Db/Schema/SchemaTest.php @@ -336,25 +336,6 @@ public function testGetViewNames(): void $this->assertSame([], $schema->getViewNames()); } - /** - * @throws ReflectionException - */ - public function testNormaliceRowKeyCase(): void - { - $db = $this->getConnection(); - - $schema = $db->getSchema(); - - $this->assertSame( - ['fk_test' => 1], - Assert::InvokeMethod($schema, 'normalizeRowKeyCase', [['Fk_test' => 1], false]), - ); - $this->assertSame( - ['FK_test' => ['uk_test' => 1]], - Assert::InvokeMethod($schema, 'normalizeRowKeyCase', [['FK_test' => ['UK_test' => 1]], true]), - ); - } - public function testRefreshTableSchema(): void { $db = $this->getConnection(true);