ITable
in
Object representation of a table.
Tags
Attributes
- #[Consumable]
- $since: '35.0.0'
Table of Contents
Methods
- addColumn() : IColumn
- addForeignKeyConstraint() : self
- Adds a foreign key constraint.
- addIndex() : self
- addUniqueConstraint() : self
- addUniqueIndex() : self
- dropColumn() : self
- Drops a Column from the Table.
- dropIndex() : self
- Drops an index from this table.
- dropPrimaryKey() : self
- Drops the primary key from this table.
- getColumn() : IColumn
- Returns the Column with the given name.
- getColumns() : array<int, IColumn>
- Returns all columns of this table.
- getForeignKeys() : array<int, IForeignKeyConstraint>
- getIndex() : IIndex
- Returns a specific index by name of this table.
- getIndexes() : array<int, IIndex>
- Returns all indexes of this table.
- getName() : non-empty-string
- Returns the name of this table.
- getPrimaryKey() : IIndex|null
- Returns the primary key, or null if this table has no primary key.
- hasColumn() : bool
- Returns whether this table has a Column with the given name.
- hasForeignKey() : bool
- Returns whether this table has a foreign key constraint with the given name.
- hasIndex() : bool
- Returns whether this table has an index with the given name.
- hasPrimaryKey() : bool
- Returns whether this table has a primary key.
- hasUniqueConstraint() : bool
- Returns whether this table has a unique constraint with the given name.
- modifyColumn() : self
- removeForeignKey() : void
- Removes the foreign key constraint with the given name.
- removeUniqueConstraint() : void
- Removes the unique constraint with the given name.
- renameIndex() : self
- Renames an index.
- setPrimaryKey() : self
- Sets the Primary Key.
Methods
addColumn()
public
addColumn(non-empty-string $name, Types::*|ColumnType $typeName[, ColumnType, comment?: string} $options = [] ]) : IColumn
Parameters
- $name : non-empty-string
- $typeName : Types::*|ColumnType
- $options : ColumnType, comment?: string} = []
Tags
Return values
IColumnaddForeignKeyConstraint()
Adds a foreign key constraint.
public
addForeignKeyConstraint(ITable|non-empty-string $foreignTable, array<int, non-empty-string> $localColumnNames, array<int, non-empty-string> $foreignColumnNames[, array<string, mixed> $options = [] ][, string|null $name = null ]) : self
Name is inferred from the local columns.
Parameters
- $foreignTable : ITable|non-empty-string
-
Table schema instance or table name
- $localColumnNames : array<int, non-empty-string>
- $foreignColumnNames : array<int, non-empty-string>
- $options : array<string, mixed> = []
- $name : string|null = null
Tags
Return values
selfaddIndex()
public
addIndex(array<int, non-empty-string> $columnNames[, non-empty-string|null $indexName = null ][, array<int, non-empty-string> $flags = [] ][, array<non-empty-string, mixed> $options = [] ]) : self
Parameters
- $columnNames : array<int, non-empty-string>
- $indexName : non-empty-string|null = null
- $flags : array<int, non-empty-string> = []
- $options : array<non-empty-string, mixed> = []
Tags
Return values
selfaddUniqueConstraint()
public
addUniqueConstraint(array<int, string> $columnNames[, string|null $indexName = null ][, array<int, string> $flags = [] ][, array<string, mixed> $options = [] ]) : self
Parameters
- $columnNames : array<int, string>
- $indexName : string|null = null
- $flags : array<int, string> = []
- $options : array<string, mixed> = []
Tags
Return values
selfaddUniqueIndex()
public
addUniqueIndex(array<int, string> $columnNames[, non-empty-string|null $indexName = null ][, array<string, mixed> $options = [] ]) : self
Parameters
- $columnNames : array<int, string>
- $indexName : non-empty-string|null = null
- $options : array<string, mixed> = []
Tags
Return values
selfdropColumn()
Drops a Column from the Table.
public
dropColumn(non-empty-string $name) : self
Parameters
- $name : non-empty-string
Tags
Return values
selfdropIndex()
Drops an index from this table.
public
dropIndex(non-empty-string $name) : self
Parameters
- $name : non-empty-string
-
The index name.
Tags
Return values
selfdropPrimaryKey()
Drops the primary key from this table.
public
dropPrimaryKey() : self
Tags
Return values
selfgetColumn()
Returns the Column with the given name.
public
getColumn(non-empty-string $name) : IColumn
Parameters
- $name : non-empty-string
-
The column name.
Tags
Return values
IColumngetColumns()
Returns all columns of this table.
public
getColumns() : array<int, IColumn>
Tags
Return values
array<int, IColumn>getForeignKeys()
public
getForeignKeys() : array<int, IForeignKeyConstraint>
Tags
Return values
array<int, IForeignKeyConstraint>getIndex()
Returns a specific index by name of this table.
public
getIndex(non-empty-string $name) : IIndex
Parameters
- $name : non-empty-string
-
The index name.
Tags
Return values
IIndexgetIndexes()
Returns all indexes of this table.
public
getIndexes() : array<int, IIndex>
Tags
Return values
array<int, IIndex>getName()
Returns the name of this table.
public
getName() : non-empty-string
Tags
Return values
non-empty-stringgetPrimaryKey()
Returns the primary key, or null if this table has no primary key.
public
getPrimaryKey() : IIndex|null
Tags
Return values
IIndex|nullhasColumn()
Returns whether this table has a Column with the given name.
public
hasColumn(non-empty-string $name) : bool
Parameters
- $name : non-empty-string
-
The column name.
Tags
Return values
boolhasForeignKey()
Returns whether this table has a foreign key constraint with the given name.
public
hasForeignKey(non-empty-string $name) : bool
Parameters
- $name : non-empty-string
-
The foreign key name.
Tags
Return values
boolhasIndex()
Returns whether this table has an index with the given name.
public
hasIndex(non-empty-string $name) : bool
Parameters
- $name : non-empty-string
-
The index name.
Tags
Return values
boolhasPrimaryKey()
Returns whether this table has a primary key.
public
hasPrimaryKey() : bool
Tags
Return values
boolhasUniqueConstraint()
Returns whether this table has a unique constraint with the given name.
public
hasUniqueConstraint(non-empty-string $name) : bool
Parameters
- $name : non-empty-string
-
The unique constraint name.
Tags
Return values
boolmodifyColumn()
public
modifyColumn(non-empty-string $name, ColumnType, comment?: string} $options) : self
Parameters
- $name : non-empty-string
- $options : ColumnType, comment?: string}
Tags
Return values
selfremoveForeignKey()
Removes the foreign key constraint with the given name.
public
removeForeignKey(non-empty-string $name) : void
Parameters
- $name : non-empty-string
-
The constraint name.
Tags
removeUniqueConstraint()
Removes the unique constraint with the given name.
public
removeUniqueConstraint(non-empty-string $name) : void
Parameters
- $name : non-empty-string
-
The unique constraint name.
Tags
renameIndex()
Renames an index.
public
renameIndex(non-empty-string $oldName[, non-empty-string|null $newName = null ]) : self
Parameters
- $oldName : non-empty-string
-
The name of the index to rename from.
- $newName : non-empty-string|null = null
-
The name of the index to rename to. If null is given, the index name will be auto-generated.
Tags
Return values
self —This table instance.
setPrimaryKey()
Sets the Primary Key.
public
setPrimaryKey(array<int, non-empty-string> $columnNames[, non-empty-string|false $indexName = false ]) : self
Parameters
- $columnNames : array<int, non-empty-string>
- $indexName : non-empty-string|false = false