Skip to content

Commit

Permalink
Merge branch 'master' into marin-3
Browse files Browse the repository at this point in the history
  • Loading branch information
vjik authored May 16, 2024
2 parents 92bb6bf + ced1afd commit b7d48fd
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 5 deletions.
File renamed without changes.
File renamed without changes.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
## 2.0.0 under development

- Enh #293: Implement `SqlParser` and `ExpressionBuilder` driver classes (@Tigrov)
- Chg #306: Remove parameter `$withColumn` from `Quoter::getTableNameParts()` method (@Tigrov)
- Chg #308: Replace call of `SchemaInterface::getRawTableName()` to `QuoterInterface::getRawTableName()` (@Tigrov)

## 1.2.0 March 21, 2024

Expand Down
8 changes: 5 additions & 3 deletions src/Quoter.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@

use Yiisoft\Db\Schema\Quoter as BaseQuoter;

use function array_map;
use function array_slice;
use function preg_match;
use function preg_match_all;

Expand All @@ -27,10 +29,10 @@ public function getTableNameParts(string $name, bool $withColumn = false): array
{
if (preg_match_all('/([^.\[\]]+)|\[([^\[\]]+)]/', $name, $matches) > 0) {
$parts = array_slice($matches[0], -4, 4);
} else {
$parts = [$name];

return array_map([$this, 'unquoteSimpleTableName'], $parts);
}

return $this->unquoteParts($parts, $withColumn);
return [$this->unquoteSimpleTableName($name)];
}
}
2 changes: 1 addition & 1 deletion src/Schema.php
Original file line number Diff line number Diff line change
Expand Up @@ -907,7 +907,7 @@ private function loadTableConstraints(string $tableName, string $returnType): mi
*/
protected function getCacheKey(string $name): array
{
return array_merge([self::class], $this->generateCacheKey(), [$this->getRawTableName($name)]);
return array_merge([self::class], $this->generateCacheKey(), [$this->db->getQuoter()->getRawTableName($name)]);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion tests/Provider/CommandProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public static function batchInsert(): array

$batchInsert['table name with column name with brackets']['expectedParams'][':qp3'] = 0;

$batchInsert['batchInsert binds params from expression']['expectedParams'][':qp3'] = 0;
$batchInsert['binds params from expression']['expectedParams'][':qp3'] = 0;
$batchInsert['with associative values']['expectedParams'][':qp3'] = 1;

return $batchInsert;
Expand Down

0 comments on commit b7d48fd

Please sign in to comment.