Replace $thingyName arguments with $name where "thingy" is clear from the context

parent c890d041
...@@ -192,15 +192,15 @@ abstract class AbstractSchemaManager ...@@ -192,15 +192,15 @@ abstract class AbstractSchemaManager
* *
* The usage of a string $tableNames is deprecated. Pass a one-element array instead. * The usage of a string $tableNames is deprecated. Pass a one-element array instead.
* *
* @param string|string[] $tableNames * @param string|string[] $names
* *
* @return bool * @return bool
*/ */
public function tablesExist($tableNames) public function tablesExist($names)
{ {
$tableNames = array_map('strtolower', (array) $tableNames); $names = array_map('strtolower', (array) $names);
return count($tableNames) === count(array_intersect($tableNames, array_map('strtolower', $this->listTableNames()))); return count($names) === count(array_intersect($names, array_map('strtolower', $this->listTableNames())));
} }
/** /**
...@@ -264,21 +264,21 @@ abstract class AbstractSchemaManager ...@@ -264,21 +264,21 @@ abstract class AbstractSchemaManager
} }
/** /**
* @param string $tableName * @param string $name
* *
* @return Table * @return Table
*/ */
public function listTableDetails($tableName) public function listTableDetails($name)
{ {
$columns = $this->listTableColumns($tableName); $columns = $this->listTableColumns($name);
$foreignKeys = []; $foreignKeys = [];
if ($this->_platform->supportsForeignKeyConstraints()) { if ($this->_platform->supportsForeignKeyConstraints()) {
$foreignKeys = $this->listTableForeignKeys($tableName); $foreignKeys = $this->listTableForeignKeys($name);
} }
$indexes = $this->listTableIndexes($tableName); $indexes = $this->listTableIndexes($name);
return new Table($tableName, $columns, $indexes, $foreignKeys); return new Table($name, $columns, $indexes, $foreignKeys);
} }
/** /**
...@@ -334,13 +334,13 @@ abstract class AbstractSchemaManager ...@@ -334,13 +334,13 @@ abstract class AbstractSchemaManager
/** /**
* Drops the given table. * Drops the given table.
* *
* @param string $tableName The name of the table to drop. * @param string $name The name of the table to drop.
* *
* @return void * @return void
*/ */
public function dropTable($tableName) public function dropTable($name)
{ {
$this->_execSql($this->_platform->getDropTableSQL($tableName)); $this->_execSql($this->_platform->getDropTableSQL($name));
} }
/** /**
......
...@@ -59,12 +59,12 @@ class Column extends AbstractAsset ...@@ -59,12 +59,12 @@ class Column extends AbstractAsset
/** /**
* Creates a new Column. * Creates a new Column.
* *
* @param string $columnName * @param string $name
* @param mixed[] $options * @param mixed[] $options
*/ */
public function __construct($columnName, Type $type, array $options = []) public function __construct($name, Type $type, array $options = [])
{ {
$this->_setName($columnName); $this->_setName($name);
$this->setType($type); $this->setType($type);
$this->setOptions($options); $this->setOptions($options);
} }
......
...@@ -222,13 +222,13 @@ class DB2SchemaManager extends AbstractSchemaManager ...@@ -222,13 +222,13 @@ class DB2SchemaManager extends AbstractSchemaManager
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function listTableDetails($tableName): Table public function listTableDetails($name): Table
{ {
$table = parent::listTableDetails($tableName); $table = parent::listTableDetails($name);
$platform = $this->_platform; $platform = $this->_platform;
assert($platform instanceof DB2Platform); assert($platform instanceof DB2Platform);
$sql = $platform->getListTableCommentsSQL($tableName); $sql = $platform->getListTableCommentsSQL($name);
$tableOptions = $this->_conn->fetchAssoc($sql); $tableOptions = $this->_conn->fetchAssoc($sql);
......
...@@ -47,18 +47,18 @@ class Index extends AbstractAsset implements Constraint ...@@ -47,18 +47,18 @@ class Index extends AbstractAsset implements Constraint
private $options = []; private $options = [];
/** /**
* @param string $indexName * @param string $name
* @param string[] $columns * @param string[] $columns
* @param bool $isUnique * @param bool $isUnique
* @param bool $isPrimary * @param bool $isPrimary
* @param string[] $flags * @param string[] $flags
* @param mixed[] $options * @param mixed[] $options
*/ */
public function __construct($indexName, array $columns, $isUnique = false, $isPrimary = false, array $flags = [], array $options = []) public function __construct($name, array $columns, $isUnique = false, $isPrimary = false, array $flags = [], array $options = [])
{ {
$isUnique = $isUnique || $isPrimary; $isUnique = $isUnique || $isPrimary;
$this->_setName($indexName); $this->_setName($name);
$this->_isUnique = $isUnique; $this->_isUnique = $isUnique;
$this->_isPrimary = $isPrimary; $this->_isPrimary = $isPrimary;
$this->options = $options; $this->options = $options;
...@@ -156,17 +156,17 @@ class Index extends AbstractAsset implements Constraint ...@@ -156,17 +156,17 @@ class Index extends AbstractAsset implements Constraint
} }
/** /**
* @param string $columnName * @param string $name
* @param int $pos * @param int $pos
* *
* @return bool * @return bool
*/ */
public function hasColumnAtPosition($columnName, $pos = 0) public function hasColumnAtPosition($name, $pos = 0)
{ {
$columnName = $this->trimQuotes(strtolower($columnName)); $name = $this->trimQuotes(strtolower($name));
$indexColumns = array_map('strtolower', $this->getUnquotedColumns()); $indexColumns = array_map('strtolower', $this->getUnquotedColumns());
return array_search($columnName, $indexColumns) === $pos; return array_search($name, $indexColumns) === $pos;
} }
/** /**
......
...@@ -320,13 +320,13 @@ class MySqlSchemaManager extends AbstractSchemaManager ...@@ -320,13 +320,13 @@ class MySqlSchemaManager extends AbstractSchemaManager
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function listTableDetails($tableName) public function listTableDetails($name)
{ {
$table = parent::listTableDetails($tableName); $table = parent::listTableDetails($name);
$platform = $this->_platform; $platform = $this->_platform;
assert($platform instanceof MySqlPlatform); assert($platform instanceof MySqlPlatform);
$sql = $platform->getListTableMetadataSQL($tableName); $sql = $platform->getListTableMetadataSQL($name);
$tableOptions = $this->_conn->fetchAssoc($sql); $tableOptions = $this->_conn->fetchAssoc($sql);
......
...@@ -400,13 +400,13 @@ SQL; ...@@ -400,13 +400,13 @@ SQL;
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function listTableDetails($tableName): Table public function listTableDetails($name): Table
{ {
$table = parent::listTableDetails($tableName); $table = parent::listTableDetails($name);
$platform = $this->_platform; $platform = $this->_platform;
assert($platform instanceof OraclePlatform); assert($platform instanceof OraclePlatform);
$sql = $platform->getListTableCommentsSQL($tableName); $sql = $platform->getListTableCommentsSQL($name);
$tableOptions = $this->_conn->fetchAssoc($sql); $tableOptions = $this->_conn->fetchAssoc($sql);
......
...@@ -506,13 +506,13 @@ class PostgreSqlSchemaManager extends AbstractSchemaManager ...@@ -506,13 +506,13 @@ class PostgreSqlSchemaManager extends AbstractSchemaManager
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function listTableDetails($tableName): Table public function listTableDetails($name): Table
{ {
$table = parent::listTableDetails($tableName); $table = parent::listTableDetails($name);
$platform = $this->_platform; $platform = $this->_platform;
assert($platform instanceof PostgreSqlPlatform); assert($platform instanceof PostgreSqlPlatform);
$sql = $platform->getListTableMetadataSQL($tableName); $sql = $platform->getListTableMetadataSQL($name);
$tableOptions = $this->_conn->fetchAssoc($sql); $tableOptions = $this->_conn->fetchAssoc($sql);
......
...@@ -331,15 +331,15 @@ class SQLServerSchemaManager extends AbstractSchemaManager ...@@ -331,15 +331,15 @@ class SQLServerSchemaManager extends AbstractSchemaManager
} }
/** /**
* @param string $tableName * @param string $name
*/ */
public function listTableDetails($tableName): Table public function listTableDetails($name): Table
{ {
$table = parent::listTableDetails($tableName); $table = parent::listTableDetails($name);
$platform = $this->_platform; $platform = $this->_platform;
assert($platform instanceof SQLServerPlatform); assert($platform instanceof SQLServerPlatform);
$sql = $platform->getListTableMetadataSQL($tableName); $sql = $platform->getListTableMetadataSQL($name);
$tableOptions = $this->_conn->fetchAssoc($sql); $tableOptions = $this->_conn->fetchAssoc($sql);
......
...@@ -165,20 +165,20 @@ class Schema extends AbstractAsset ...@@ -165,20 +165,20 @@ class Schema extends AbstractAsset
} }
/** /**
* @param string $tableName * @param string $name
* *
* @return Table * @return Table
* *
* @throws SchemaException * @throws SchemaException
*/ */
public function getTable($tableName) public function getTable($name)
{ {
$tableName = $this->getFullQualifiedAssetName($tableName); $name = $this->getFullQualifiedAssetName($name);
if (! isset($this->_tables[$tableName])) { if (! isset($this->_tables[$name])) {
throw SchemaException::tableDoesNotExist($tableName); throw SchemaException::tableDoesNotExist($name);
} }
return $this->_tables[$tableName]; return $this->_tables[$name];
} }
/** /**
...@@ -216,29 +216,29 @@ class Schema extends AbstractAsset ...@@ -216,29 +216,29 @@ class Schema extends AbstractAsset
/** /**
* Does this schema have a namespace with the given name? * Does this schema have a namespace with the given name?
* *
* @param string $namespaceName * @param string $name
* *
* @return bool * @return bool
*/ */
public function hasNamespace($namespaceName) public function hasNamespace($name)
{ {
$namespaceName = strtolower($this->getUnquotedAssetName($namespaceName)); $name = strtolower($this->getUnquotedAssetName($name));
return isset($this->namespaces[$namespaceName]); return isset($this->namespaces[$name]);
} }
/** /**
* Does this schema have a table with the given name? * Does this schema have a table with the given name?
* *
* @param string $tableName * @param string $name
* *
* @return bool * @return bool
*/ */
public function hasTable($tableName) public function hasTable($name)
{ {
$tableName = $this->getFullQualifiedAssetName($tableName); $name = $this->getFullQualifiedAssetName($name);
return isset($this->_tables[$tableName]); return isset($this->_tables[$name]);
} }
/** /**
...@@ -291,21 +291,21 @@ class Schema extends AbstractAsset ...@@ -291,21 +291,21 @@ class Schema extends AbstractAsset
/** /**
* Creates a new namespace. * Creates a new namespace.
* *
* @param string $namespaceName The name of the namespace to create. * @param string $name The name of the namespace to create.
* *
* @return Schema This schema instance. * @return Schema This schema instance.
* *
* @throws SchemaException * @throws SchemaException
*/ */
public function createNamespace($namespaceName) public function createNamespace($name)
{ {
$unquotedNamespaceName = strtolower($this->getUnquotedAssetName($namespaceName)); $unquotedName = strtolower($this->getUnquotedAssetName($name));
if (isset($this->namespaces[$unquotedNamespaceName])) { if (isset($this->namespaces[$unquotedName])) {
throw SchemaException::namespaceAlreadyExists($unquotedNamespaceName); throw SchemaException::namespaceAlreadyExists($unquotedName);
} }
$this->namespaces[$unquotedNamespaceName] = $namespaceName; $this->namespaces[$unquotedName] = $name;
return $this; return $this;
} }
...@@ -313,17 +313,17 @@ class Schema extends AbstractAsset ...@@ -313,17 +313,17 @@ class Schema extends AbstractAsset
/** /**
* Creates a new table. * Creates a new table.
* *
* @param string $tableName * @param string $name
* *
* @return Table * @return Table
*/ */
public function createTable($tableName) public function createTable($name)
{ {
$table = new Table($tableName); $table = new Table($name);
$this->_addTable($table); $this->_addTable($table);
foreach ($this->_schemaConfig->getDefaultTableOptions() as $name => $value) { foreach ($this->_schemaConfig->getDefaultTableOptions() as $option => $value) {
$table->addOption($name, $value); $table->addOption($option, $value);
} }
return $table; return $table;
...@@ -332,17 +332,17 @@ class Schema extends AbstractAsset ...@@ -332,17 +332,17 @@ class Schema extends AbstractAsset
/** /**
* Renames a table. * Renames a table.
* *
* @param string $oldTableName * @param string $oldName
* @param string $newTableName * @param string $newName
* *
* @return Schema * @return Schema
*/ */
public function renameTable($oldTableName, $newTableName) public function renameTable($oldName, $newName)
{ {
$table = $this->getTable($oldTableName); $table = $this->getTable($oldName);
$table->_setName($newTableName); $table->_setName($newName);
$this->dropTable($oldTableName); $this->dropTable($oldName);
$this->_addTable($table); $this->_addTable($table);
return $this; return $this;
...@@ -351,15 +351,15 @@ class Schema extends AbstractAsset ...@@ -351,15 +351,15 @@ class Schema extends AbstractAsset
/** /**
* Drops a table from the schema. * Drops a table from the schema.
* *
* @param string $tableName * @param string $name
* *
* @return Schema * @return Schema
*/ */
public function dropTable($tableName) public function dropTable($name)
{ {
$tableName = $this->getFullQualifiedAssetName($tableName); $name = $this->getFullQualifiedAssetName($name);
$this->getTable($tableName); $this->getTable($name);
unset($this->_tables[$tableName]); unset($this->_tables[$name]);
return $this; return $this;
} }
......
...@@ -537,15 +537,15 @@ SQL ...@@ -537,15 +537,15 @@ SQL
} }
/** /**
* @param string $tableName * @param string $name
*/ */
public function listTableDetails($tableName): Table public function listTableDetails($name): Table
{ {
$table = parent::listTableDetails($tableName); $table = parent::listTableDetails($name);
$tableCreateSql = $this->getCreateTableSQL($tableName) ?? ''; $tableCreateSql = $this->getCreateTableSQL($name) ?? '';
$comment = $this->parseTableCommentFromSQL($tableName, $tableCreateSql); $comment = $this->parseTableCommentFromSQL($name, $tableCreateSql);
if ($comment !== null) { if ($comment !== null) {
$table->addOption('comment', $comment); $table->addOption('comment', $comment);
......
...@@ -44,7 +44,7 @@ class Table extends AbstractAsset ...@@ -44,7 +44,7 @@ class Table extends AbstractAsset
protected $_schemaConfig = null; protected $_schemaConfig = null;
/** /**
* @param string $tableName * @param string $name
* @param Column[] $columns * @param Column[] $columns
* @param Index[] $indexes * @param Index[] $indexes
* @param ForeignKeyConstraint[] $fkConstraints * @param ForeignKeyConstraint[] $fkConstraints
...@@ -53,13 +53,13 @@ class Table extends AbstractAsset ...@@ -53,13 +53,13 @@ class Table extends AbstractAsset
* *
* @throws DBALException * @throws DBALException
*/ */
public function __construct($tableName, array $columns = [], array $indexes = [], array $fkConstraints = [], $idGeneratorType = 0, array $options = []) public function __construct($name, array $columns = [], array $indexes = [], array $fkConstraints = [], $idGeneratorType = 0, array $options = [])
{ {
if (strlen($tableName) === 0) { if (strlen($name) === 0) {
throw DBALException::invalidTableName($tableName); throw DBALException::invalidTableName($name);
} }
$this->_setName($tableName); $this->_setName($name);
foreach ($columns as $column) { foreach ($columns as $column) {
$this->_addColumn($column); $this->_addColumn($column);
...@@ -151,20 +151,20 @@ class Table extends AbstractAsset ...@@ -151,20 +151,20 @@ class Table extends AbstractAsset
/** /**
* Drops an index from this table. * Drops an index from this table.
* *
* @param string $indexName The index name. * @param string $name The index name.
* *
* @return void * @return void
* *
* @throws SchemaException If the index does not exist. * @throws SchemaException If the index does not exist.
*/ */
public function dropIndex($indexName) public function dropIndex($name)
{ {
$indexName = $this->normalizeIdentifier($indexName); $name = $this->normalizeIdentifier($name);
if (! $this->hasIndex($indexName)) { if (! $this->hasIndex($name)) {
throw SchemaException::indexDoesNotExist($indexName, $this->_name); throw SchemaException::indexDoesNotExist($name, $this->_name);
} }
unset($this->_indexes[$indexName]); unset($this->_indexes[$name]);
} }
/** /**
...@@ -190,8 +190,8 @@ class Table extends AbstractAsset ...@@ -190,8 +190,8 @@ class Table extends AbstractAsset
/** /**
* Renames an index. * Renames an index.
* *
* @param string $oldIndexName The name of the index to rename from. * @param string $oldName The name of the index to rename from.
* @param string|null $newIndexName The name of the index to rename to. * @param string|null $newName The name of the index to rename to.
* If null is given, the index name will be auto-generated. * If null is given, the index name will be auto-generated.
* *
* @return self This table instance. * @return self This table instance.
...@@ -199,38 +199,38 @@ class Table extends AbstractAsset ...@@ -199,38 +199,38 @@ class Table extends AbstractAsset
* @throws SchemaException If no index exists for the given current name * @throws SchemaException If no index exists for the given current name
* or if an index with the given new name already exists on this table. * or if an index with the given new name already exists on this table.
*/ */
public function renameIndex($oldIndexName, $newIndexName = null) public function renameIndex($oldName, $newName = null)
{ {
$oldIndexName = $this->normalizeIdentifier($oldIndexName); $oldName = $this->normalizeIdentifier($oldName);
$normalizedNewIndexName = $this->normalizeIdentifier($newIndexName); $normalizedNewName = $this->normalizeIdentifier($newName);
if ($oldIndexName === $normalizedNewIndexName) { if ($oldName === $normalizedNewName) {
return $this; return $this;
} }
if (! $this->hasIndex($oldIndexName)) { if (! $this->hasIndex($oldName)) {
throw SchemaException::indexDoesNotExist($oldIndexName, $this->_name); throw SchemaException::indexDoesNotExist($oldName, $this->_name);
} }
if ($this->hasIndex($normalizedNewIndexName)) { if ($this->hasIndex($normalizedNewName)) {
throw SchemaException::indexAlreadyExists($normalizedNewIndexName, $this->_name); throw SchemaException::indexAlreadyExists($normalizedNewName, $this->_name);
} }
$oldIndex = $this->_indexes[$oldIndexName]; $oldIndex = $this->_indexes[$oldName];
if ($oldIndex->isPrimary()) { if ($oldIndex->isPrimary()) {
$this->dropPrimaryKey(); $this->dropPrimaryKey();
return $this->setPrimaryKey($oldIndex->getColumns(), $newIndexName ?? false); return $this->setPrimaryKey($oldIndex->getColumns(), $newName ?? false);
} }
unset($this->_indexes[$oldIndexName]); unset($this->_indexes[$oldName]);
if ($oldIndex->isUnique()) { if ($oldIndex->isUnique()) {
return $this->addUniqueIndex($oldIndex->getColumns(), $newIndexName, $oldIndex->getOptions()); return $this->addUniqueIndex($oldIndex->getColumns(), $newName, $oldIndex->getOptions());
} }
return $this->addIndex($oldIndex->getColumns(), $newIndexName, $oldIndex->getFlags(), $oldIndex->getOptions()); return $this->addIndex($oldIndex->getColumns(), $newName, $oldIndex->getFlags(), $oldIndex->getOptions());
} }
/** /**
...@@ -279,15 +279,15 @@ class Table extends AbstractAsset ...@@ -279,15 +279,15 @@ class Table extends AbstractAsset
} }
/** /**
* @param string $columnName * @param string $name
* @param string $typeName * @param string $typeName
* @param mixed[] $options * @param mixed[] $options
* *
* @return Column * @return Column
*/ */
public function addColumn($columnName, $typeName, array $options = []) public function addColumn($name, $typeName, array $options = [])
{ {
$column = new Column($columnName, Type::getType($typeName), $options); $column = new Column($name, Type::getType($typeName), $options);
$this->_addColumn($column); $this->_addColumn($column);
...@@ -299,14 +299,14 @@ class Table extends AbstractAsset ...@@ -299,14 +299,14 @@ class Table extends AbstractAsset
* *
* @deprecated * @deprecated
* *
* @param string $oldColumnName * @param string $oldName
* @param string $newColumnName * @param string $name
* *
* @return void * @return void
* *
* @throws DBALException * @throws DBALException
*/ */
public function renameColumn($oldColumnName, $newColumnName) public function renameColumn($oldName, $name)
{ {
throw new DBALException('Table#renameColumn() was removed, because it drops and recreates ' . throw new DBALException('Table#renameColumn() was removed, because it drops and recreates ' .
'the column instead. There is no fix available, because a schema diff cannot reliably detect if a ' . 'the column instead. There is no fix available, because a schema diff cannot reliably detect if a ' .
...@@ -316,14 +316,14 @@ class Table extends AbstractAsset ...@@ -316,14 +316,14 @@ class Table extends AbstractAsset
/** /**
* Change Column Details. * Change Column Details.
* *
* @param string $columnName * @param string $name
* @param mixed[] $options * @param mixed[] $options
* *
* @return self * @return self
*/ */
public function changeColumn($columnName, array $options) public function changeColumn($name, array $options)
{ {
$column = $this->getColumn($columnName); $column = $this->getColumn($name);
$column->setOptions($options); $column->setOptions($options);
return $this; return $this;
...@@ -332,14 +332,14 @@ class Table extends AbstractAsset ...@@ -332,14 +332,14 @@ class Table extends AbstractAsset
/** /**
* Drops a Column from the Table. * Drops a Column from the Table.
* *
* @param string $columnName * @param string $name
* *
* @return self * @return self
*/ */
public function dropColumn($columnName) public function dropColumn($name)
{ {
$columnName = $this->normalizeIdentifier($columnName); $name = $this->normalizeIdentifier($name);
unset($this->_columns[$columnName]); unset($this->_columns[$name]);
return $this; return $this;
} }
...@@ -541,53 +541,53 @@ class Table extends AbstractAsset ...@@ -541,53 +541,53 @@ class Table extends AbstractAsset
/** /**
* Returns whether this table has a foreign key constraint with the given name. * Returns whether this table has a foreign key constraint with the given name.
* *
* @param string $constraintName * @param string $name
* *
* @return bool * @return bool
*/ */
public function hasForeignKey($constraintName) public function hasForeignKey($name)
{ {
$constraintName = $this->normalizeIdentifier($constraintName); $name = $this->normalizeIdentifier($name);
return isset($this->_fkConstraints[$constraintName]); return isset($this->_fkConstraints[$name]);
} }
/** /**
* Returns the foreign key constraint with the given name. * Returns the foreign key constraint with the given name.
* *
* @param string $constraintName The constraint name. * @param string $name The constraint name.
* *
* @return ForeignKeyConstraint * @return ForeignKeyConstraint
* *
* @throws SchemaException If the foreign key does not exist. * @throws SchemaException If the foreign key does not exist.
*/ */
public function getForeignKey($constraintName) public function getForeignKey($name)
{ {
$constraintName = $this->normalizeIdentifier($constraintName); $name = $this->normalizeIdentifier($name);
if (! $this->hasForeignKey($constraintName)) { if (! $this->hasForeignKey($name)) {
throw SchemaException::foreignKeyDoesNotExist($constraintName, $this->_name); throw SchemaException::foreignKeyDoesNotExist($name, $this->_name);
} }
return $this->_fkConstraints[$constraintName]; return $this->_fkConstraints[$name];
} }
/** /**
* Removes the foreign key constraint with the given name. * Removes the foreign key constraint with the given name.
* *
* @param string $constraintName The constraint name. * @param string $name The constraint name.
* *
* @return void * @return void
* *
* @throws SchemaException * @throws SchemaException
*/ */
public function removeForeignKey($constraintName) public function removeForeignKey($name)
{ {
$constraintName = $this->normalizeIdentifier($constraintName); $name = $this->normalizeIdentifier($name);
if (! $this->hasForeignKey($constraintName)) { if (! $this->hasForeignKey($name)) {
throw SchemaException::foreignKeyDoesNotExist($constraintName, $this->_name); throw SchemaException::foreignKeyDoesNotExist($name, $this->_name);
} }
unset($this->_fkConstraints[$constraintName]); unset($this->_fkConstraints[$name]);
} }
/** /**
...@@ -639,34 +639,34 @@ class Table extends AbstractAsset ...@@ -639,34 +639,34 @@ class Table extends AbstractAsset
/** /**
* Returns whether this table has a Column with the given name. * Returns whether this table has a Column with the given name.
* *
* @param string $columnName The column name. * @param string $name The column name.
* *
* @return bool * @return bool
*/ */
public function hasColumn($columnName) public function hasColumn($name)
{ {
$columnName = $this->normalizeIdentifier($columnName); $name = $this->normalizeIdentifier($name);
return isset($this->_columns[$columnName]); return isset($this->_columns[$name]);
} }
/** /**
* Returns the Column with the given name. * Returns the Column with the given name.
* *
* @param string $columnName The column name. * @param string $name The column name.
* *
* @return Column * @return Column
* *
* @throws SchemaException If the column does not exist. * @throws SchemaException If the column does not exist.
*/ */
public function getColumn($columnName) public function getColumn($name)
{ {
$columnName = $this->normalizeIdentifier($columnName); $name = $this->normalizeIdentifier($name);
if (! $this->hasColumn($columnName)) { if (! $this->hasColumn($name)) {
throw SchemaException::columnDoesNotExist($columnName, $this->_name); throw SchemaException::columnDoesNotExist($name, $this->_name);
} }
return $this->_columns[$columnName]; return $this->_columns[$name];
} }
/** /**
...@@ -714,34 +714,34 @@ class Table extends AbstractAsset ...@@ -714,34 +714,34 @@ class Table extends AbstractAsset
/** /**
* Returns whether this table has an Index with the given name. * Returns whether this table has an Index with the given name.
* *
* @param string $indexName The index name. * @param string $name The index name.
* *
* @return bool * @return bool
*/ */
public function hasIndex($indexName) public function hasIndex($name)
{ {
$indexName = $this->normalizeIdentifier($indexName); $name = $this->normalizeIdentifier($name);
return isset($this->_indexes[$indexName]); return isset($this->_indexes[$name]);
} }
/** /**
* Returns the Index with the given name. * Returns the Index with the given name.
* *
* @param string $indexName The index name. * @param string $name The index name.
* *
* @return Index * @return Index
* *
* @throws SchemaException If the index does not exist. * @throws SchemaException If the index does not exist.
*/ */
public function getIndex($indexName) public function getIndex($name)
{ {
$indexName = $this->normalizeIdentifier($indexName); $name = $this->normalizeIdentifier($name);
if (! $this->hasIndex($indexName)) { if (! $this->hasIndex($name)) {
throw SchemaException::indexDoesNotExist($indexName, $this->_name); throw SchemaException::indexDoesNotExist($name, $this->_name);
} }
return $this->_indexes[$indexName]; return $this->_indexes[$name];
} }
/** /**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment