Skip to content

Commit

Permalink
Remove SchemaInterface::getRawTableName() method
Browse files Browse the repository at this point in the history
  • Loading branch information
Tigrov committed May 10, 2024
1 parent 645b690 commit 907ab49
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 36 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@
- 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)
- Chg #846: Remove `SchemaInterface::isReadQuery()` method (@Tigrov)
- Chg #846: Remove `SchemaInterface::isReadQuery()` and `AbstractSchema::isReadQuery()` methods (@Tigrov)
- Chg #847: Remove `SchemaInterface::getRawTableName()` and `AbstractSchema::getRawTableName()` methods (@Tigrov)

## 1.3.0 March 21, 2024

Expand Down
2 changes: 2 additions & 0 deletions UPGRADE.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ $db->createCommand()->insertBatch('user', $values)->execute();
- `TableSchemaInterface::compositeForeignKey()`
- `SchemaInterface::isReadQuery()`
- `AbstractSchema::isReadQuery()`
- `SchemaInterface::getRawTableName()`
- `AbstractSchema::getRawTableName()`
- `AbstractSchema::normalizeRowKeyCase()`
- `Quoter::unquoteParts()`
- `AbstractPdoCommand::logQuery()`
Expand Down
25 changes: 4 additions & 21 deletions src/Schema/AbstractSchema.php
Original file line number Diff line number Diff line change
Expand Up @@ -141,18 +141,6 @@ public function getDataType(mixed $data): int
};
}

/** @deprecated Use {@see Quoter::getRawTableName()}. Will be removed in version 2.0.0. */
public function getRawTableName(string $name): string
{
if (str_contains($name, '{{')) {
$name = preg_replace('/{{(.*?)}}/', '\1', $name);

return str_replace('%', $this->db->getTablePrefix(), $name);
}

return $name;
}

/**
* @throws InvalidArgumentException
* @throws NotSupportedException
Expand Down Expand Up @@ -331,8 +319,7 @@ public function refresh(): void
*/
public function refreshTableSchema(string $name): void
{
/** @psalm-suppress DeprecatedMethod */
$rawName = $this->getRawTableName($name);
$rawName = $this->db->getQuoter()->getRawTableName($name);

unset($this->tableMetadata[$rawName]);

Expand Down Expand Up @@ -462,8 +449,7 @@ protected function getSchemaMetadata(string $schema, string $type, bool $refresh
*/
protected function getTableMetadata(string $name, string $type, bool $refresh = false): mixed
{
/** @psalm-suppress DeprecatedMethod */
$rawName = $this->getRawTableName($name);
$rawName = $this->db->getQuoter()->getRawTableName($name);

if (!isset($this->tableMetadata[$rawName])) {
$this->loadTableMetadataFromCache($rawName);
Expand Down Expand Up @@ -543,11 +529,8 @@ protected function resolveTableName(string $name): TableSchemaInterface
*/
protected function setTableMetadata(string $name, string $type, mixed $data): void
{
/**
* @psalm-suppress MixedArrayAssignment
* @psalm-suppress DeprecatedMethod
*/
$this->tableMetadata[$this->getRawTableName($name)][$type] = $data;
/** @psalm-suppress MixedArrayAssignment */
$this->tableMetadata[$this->db->getQuoter()->getRawTableName($name)][$type] = $data;
}

/**
Expand Down
14 changes: 0 additions & 14 deletions src/Schema/SchemaInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -269,20 +269,6 @@ public function getDefaultSchema(): string|null;
*/
public function getDataType(mixed $data): int;

/**
* Returns the actual name of a given table name.
*
* This method will strip off curly brackets from the given table name and replace the percentage character '%' with
* {@see ConnectionInterface::tablePrefix}.
*
* @param string $name The table name to convert.
*
* @return string The real name of the given table name.
*
* @deprecated Use {@see Quoter::getRawTableName()}. Will be removed in version 2.0.0.
*/
public function getRawTableName(string $name): string;

/**
* Returns all schema names in the database, except system schemas.
*
Expand Down

0 comments on commit 907ab49

Please sign in to comment.