Skip to content

Commit

Permalink
Better naming helpers. (#277)
Browse files Browse the repository at this point in the history
  • Loading branch information
terabytesoftw authored Apr 5, 2023
1 parent e9c25e3 commit d9f47ff
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/Schema.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
use Yiisoft\Db\Exception\InvalidConfigException;
use Yiisoft\Db\Exception\NotSupportedException;
use Yiisoft\Db\Expression\Expression;
use Yiisoft\Db\Helper\ArrayHelper;
use Yiisoft\Db\Helper\DbArrayHelper;
use Yiisoft\Db\Schema\Builder\AbstractColumn;
use Yiisoft\Db\Schema\Builder\ColumnInterface;
use Yiisoft\Db\Schema\ColumnSchemaInterface;
Expand Down Expand Up @@ -672,7 +672,7 @@ private function loadTableConstraints(string $tableName, string $returnType): ar

/** @psalm-var array[][] $constraints */
$constraints = $this->normalizeRowKeyCase($constraints, true);
$constraints = ArrayHelper::index($constraints, null, ['type', 'name']);
$constraints = DbArrayHelper::index($constraints, null, ['type', 'name']);

$result = [
self::PRIMARY_KEY => null,
Expand All @@ -693,21 +693,21 @@ private function loadTableConstraints(string $tableName, string $returnType): ar
switch ($type) {
case 'PRIMARY KEY':
$result[self::PRIMARY_KEY] = (new Constraint())
->columnNames(ArrayHelper::getColumn($constraint, 'column_name'));
->columnNames(DbArrayHelper::getColumn($constraint, 'column_name'));
break;
case 'FOREIGN KEY':
$result[self::FOREIGN_KEYS][] = (new ForeignKeyConstraint())
->foreignSchemaName($constraint[0]['foreign_table_schema'])
->foreignTableName($constraint[0]['foreign_table_name'])
->foreignColumnNames(ArrayHelper::getColumn($constraint, 'foreign_column_name'))
->foreignColumnNames(DbArrayHelper::getColumn($constraint, 'foreign_column_name'))
->onDelete($constraint[0]['on_delete'])
->onUpdate($constraint[0]['on_update'])
->columnNames(ArrayHelper::getColumn($constraint, 'column_name'))
->columnNames(DbArrayHelper::getColumn($constraint, 'column_name'))
->name($name);
break;
case 'UNIQUE':
$result[self::UNIQUES][] = (new Constraint())
->columnNames(ArrayHelper::getColumn($constraint, 'column_name'))
->columnNames(DbArrayHelper::getColumn($constraint, 'column_name'))
->name($name);
break;
}
Expand Down Expand Up @@ -787,7 +787,7 @@ protected function loadTableIndexes(string $tableName): array

/** @psalm-var array[] $indexes */
$indexes = $this->normalizeRowKeyCase($indexes, true);
$indexes = ArrayHelper::index($indexes, null, ['name']);
$indexes = DbArrayHelper::index($indexes, null, ['name']);
$result = [];

/**
Expand All @@ -800,7 +800,7 @@ protected function loadTableIndexes(string $tableName): array
$ic->primary((bool) $index[0]['index_is_primary']);
$ic->unique((bool) $index[0]['index_is_unique']);
$ic->name($name !== 'PRIMARY' ? $name : null);
$ic->columnNames(ArrayHelper::getColumn($index, 'column_name'));
$ic->columnNames(DbArrayHelper::getColumn($index, 'column_name'));

$result[] = $ic;
}
Expand Down

0 comments on commit d9f47ff

Please sign in to comment.