Skip to content

Commit

Permalink
Remove AbstractSchema::normalizeRowKeyCase() method (#845)
Browse files Browse the repository at this point in the history
  • Loading branch information
Tigrov authored May 10, 2024
1 parent 5baf5ab commit ca37aa1
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 41 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
1 change: 1 addition & 0 deletions UPGRADE.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ $db->createCommand()->insertBatch('user', $values)->execute();

- `AbstractDMLQueryBuilder::getTypecastValue()`
- `TableSchemaInterface::compositeForeignKey()`
- `AbstractSchema::normalizeRowKeyCase()`
- `Quoter::unquoteParts()`
- `AbstractPdoCommand::logQuery()`

Expand Down
22 changes: 0 additions & 22 deletions src/Schema/AbstractSchema.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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).
*
Expand Down
19 changes: 0 additions & 19 deletions tests/Db/Schema/SchemaTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit ca37aa1

Please sign in to comment.