diff --git a/CHANGELOG.md b/CHANGELOG.md index dd7283b12..3092a1ed0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,8 @@ of `AbstractDMLQueryBuilder` class (@Tigrov) - Chg #838: Remove `SchemaInterface::TYPE_JSONB` constant (@Tigrov) - Chg #839: Remove `TableSchemaInterface::compositeForeignKey()` method (@Tigrov) +- Chg #840: Remove parameter `$withColumn` from `QuoterInterface::getTableNameParts()` method (@Tigrov) +- Chg #840: Remove `Quoter::unquoteParts()` method (@Tigrov) ## 1.3.0 March 21, 2024 diff --git a/UPGRADE.md b/UPGRADE.md index 6af704b1f..74a87e527 100644 --- a/UPGRADE.md +++ b/UPGRADE.md @@ -59,15 +59,17 @@ $db->createCommand()->insertBatch('user', $values)->execute(); - `QuoterInterface::getRawTableName()` - returns the raw table name without quotes. -### Remove deprecated methods +### Remove methods - `AbstractDMLQueryBuilder::getTypecastValue()` - `TableSchemaInterface::compositeForeignKey()` +- `Quoter::unquoteParts()` ### Remove deprecated parameters -- `$table` parameter from `AbstractDMLQueryBuilder::normalizeColumnNames()` method -- `$table` parameter from `AbstractDMLQueryBuilder::getNormalizeColumnNames()` method +- `$table` from `AbstractDMLQueryBuilder::normalizeColumnNames()` method +- `$table` from `AbstractDMLQueryBuilder::getNormalizeColumnNames()` method +- `$withColumn` from `QuoterInterface::getTableNameParts()` method ### Remove deprecated constants diff --git a/src/Schema/Quoter.php b/src/Schema/Quoter.php index 18f78aa2e..7ec65b4eb 100644 --- a/src/Schema/Quoter.php +++ b/src/Schema/Quoter.php @@ -8,6 +8,7 @@ use Yiisoft\Db\Expression\ExpressionInterface; use function addcslashes; +use function array_map; use function array_slice; use function count; use function explode; @@ -94,11 +95,11 @@ public function getRawTableName(string $name): string return $name; } - public function getTableNameParts(string $name, bool $withColumn = false): array + public function getTableNameParts(string $name): array { $parts = array_slice(explode('.', $name), -2, 2); - return $this->unquoteParts($parts, $withColumn); + return array_map([$this, 'unquoteSimpleTableName'], $parts); } public function ensureNameQuoted(string $name): string @@ -245,22 +246,4 @@ public function unquoteSimpleTableName(string $name): string ? $name : substr($name, 1, -1); } - - /** - * @psalm-param string[] $parts Parts of table name - * - * @psalm-return string[] - */ - protected function unquoteParts(array $parts, bool $withColumn): array - { - $lastKey = count($parts) - 1; - - foreach ($parts as $k => &$part) { - $part = ($withColumn && $lastKey === $k) ? - $this->unquoteSimpleColumnName($part) : - $this->unquoteSimpleTableName($part); - } - - return $parts; - } } diff --git a/src/Schema/QuoterInterface.php b/src/Schema/QuoterInterface.php index 9435c434c..7f2325928 100644 --- a/src/Schema/QuoterInterface.php +++ b/src/Schema/QuoterInterface.php @@ -42,11 +42,10 @@ public function getRawTableName(string $name): string; * Splits full table name into parts. * * @param string $name The full name of the table. - * @param bool $withColumn Deprecated. Will be removed in version 2.0.0. * * @return string[] The table name parts. */ - public function getTableNameParts(string $name, bool $withColumn = false): array; + public function getTableNameParts(string $name): array; /** * Ensures name is wrapped with `{{ and }}`.