class Table extends AbstractAsset (View source)

Object Representation of a table

Properties

protected string $_name
protected string $_namespace Namespace of the asset. If none isset the default namespace is assumed. from AbstractAsset
protected bool $_quoted from AbstractAsset
protected array $_columns
protected array $_indexes
protected string $_primaryKeyName
protected array $_fkConstraints
protected array $_options
protected SchemaConfig $_schemaConfig

Methods

_setName(string $name)

Set name of this asset

bool
isInDefaultNamespace(string $defaultNamespaceName)

Is this asset in the default namespace?

string
getNamespaceName()

Get namespace name of this asset.

string
getShortestName(string $defaultNamespaceName)

The shortest name is stripped of the default namespace. All other namespaced elements are returned as full-qualified names.

string
getFullQualifiedName($defaultNamespaceName)

The normalized name is full-qualified and lowerspaced. Lowerspacing is actually wrong, but we have to do it to keep our sanity. If you are using database objects that only differentiate in the casing (FOO vs Foo) then you will NOT be able to use Doctrine Schema abstraction.

bool
isQuoted()

Check if this asset's name is quoted

bool
isIdentifierQuoted(string $identifier)

Check if this identifier is quoted.

string
trimQuotes(string $identifier)

Trim quotes from the identifier.

string
getName()

Return name of this schema asset.

string
getQuotedName(AbstractPlatform $platform)

Get the quoted representation of this asset but only if it was defined with one. Otherwise return the plain unquoted value as inserted.

string
_generateIdentifierName(array $columnNames, string $prefix = '', int $maxSize = 30)

Generate an identifier from a list of column names obeying a certain string length.

__construct(string $tableName, array $columns = array(), array $indexes = array(), array $fkConstraints = array(), int $idGeneratorType = 0, array $options = array())

No description

setSchemaConfig(SchemaConfig $schemaConfig)

No description

int
_getMaxIdentifierLength()

No description

setPrimaryKey(array $columns, string $indexName = false)

Set Primary Key

addIndex(array $columnNames, string $indexName = null)

No description

void
dropPrimaryKey()

Drop an index from this table.

void
dropIndex(string $indexName)

Drop an index from this table.

addUniqueIndex(array $columnNames, string $indexName = null)

No description

bool
columnsAreIndexed(array $columnsNames)

Check if an index begins in the order of the given columns.

addColumn($columnName, $typeName, array $options = array())

No description

renameColumn(string $oldColumnName, string $newColumnName)

Rename Column

changeColumn(string $columnName, array $options)

Change Column Details

dropColumn(string $columnName)

Drop Column from Table

addForeignKeyConstraint($foreignTable, array $localColumnNames, array $foreignColumnNames, array $options = array(), $constraintName = null)

Add a foreign key constraint

addUnnamedForeignKeyConstraint($foreignTable, array $localColumnNames, array $foreignColumnNames, array $options = array()) deprecated

Add a foreign key constraint

addNamedForeignKeyConstraint($name, $foreignTable, array $localColumnNames, array $foreignColumnNames, array $options = array()) deprecated

Add a foreign key constraint with a given name

addOption(string $name, string $value)

No description

_addColumn(Column $column)

No description

_addIndex(Index $indexCandidate)

Add index to table

_addForeignKeyConstraint(ForeignKeyConstraint $constraint)

No description

bool
hasForeignKey(string $constraintName)

Does Table have a foreign key constraint with the given name? *

getForeignKey(string $constraintName)

No description

removeForeignKey($constraintName)

No description

Column[]
getColumns()

No description

bool
hasColumn(string $columnName)

Does this table have a column with the given name?

getColumn(string $columnName)

Get a column instance

Index|null
getPrimaryKey()

No description

getPrimaryKeyColumns()

No description

bool
hasPrimaryKey()

Check if this table has a primary key.

bool
hasIndex(string $indexName)

No description

getIndex(string $indexName)

No description

array
getIndexes()

No description

array
getForeignKeys()

Get Constraints

hasOption($name)

No description

getOption($name)

No description

getOptions()

No description

visit(Visitor $visitor)

No description

__clone()

Clone of a Table triggers a deep clone of all affected assets

Details

protected _setName(string $name)

Set name of this asset

Parameters

string $name

bool isInDefaultNamespace(string $defaultNamespaceName)

Is this asset in the default namespace?

Parameters

string $defaultNamespaceName

Return Value

bool

string getNamespaceName()

Get namespace name of this asset.

If NULL is returned this means the default namespace is used.

Return Value

string

string getShortestName(string $defaultNamespaceName)

The shortest name is stripped of the default namespace. All other namespaced elements are returned as full-qualified names.

Parameters

string $defaultNamespaceName

Return Value

string

string getFullQualifiedName($defaultNamespaceName)

The normalized name is full-qualified and lowerspaced. Lowerspacing is actually wrong, but we have to do it to keep our sanity. If you are using database objects that only differentiate in the casing (FOO vs Foo) then you will NOT be able to use Doctrine Schema abstraction.

Every non-namespaced element is prefixed with the default namespace name which is passed as argument to this method.

Parameters

$defaultNamespaceName

Return Value

string

bool isQuoted()

Check if this asset's name is quoted

Return Value

bool

protected bool isIdentifierQuoted(string $identifier)

Check if this identifier is quoted.

Parameters

string $identifier

Return Value

bool

protected string trimQuotes(string $identifier)

Trim quotes from the identifier.

Parameters

string $identifier

Return Value

string

string getName()

Return name of this schema asset.

Return Value

string

string getQuotedName(AbstractPlatform $platform)

Get the quoted representation of this asset but only if it was defined with one. Otherwise return the plain unquoted value as inserted.

Parameters

AbstractPlatform $platform

Return Value

string

protected string _generateIdentifierName(array $columnNames, string $prefix = '', int $maxSize = 30)

Generate an identifier from a list of column names obeying a certain string length.

This is especially important for Oracle, since it does not allow identifiers larger than 30 chars, however building idents automatically for foreign keys, composite keys or such can easily create very long names.

Parameters

array $columnNames
string $prefix
int $maxSize

Return Value

string

__construct(string $tableName, array $columns = array(), array $indexes = array(), array $fkConstraints = array(), int $idGeneratorType = 0, array $options = array())

Parameters

string $tableName
array $columns
array $indexes
array $fkConstraints
int $idGeneratorType
array $options

setSchemaConfig(SchemaConfig $schemaConfig)

Parameters

SchemaConfig $schemaConfig

protected int _getMaxIdentifierLength()

Return Value

int

Table setPrimaryKey(array $columns, string $indexName = false)

Set Primary Key

Parameters

array $columns
string $indexName

Return Value

Table

Table addIndex(array $columnNames, string $indexName = null)

Parameters

array $columnNames
string $indexName

Return Value

Table

void dropPrimaryKey()

Drop an index from this table.

Return Value

void

void dropIndex(string $indexName)

Drop an index from this table.

Parameters

string $indexName

Return Value

void

Table addUniqueIndex(array $columnNames, string $indexName = null)

Parameters

array $columnNames
string $indexName

Return Value

Table

bool columnsAreIndexed(array $columnsNames)

Check if an index begins in the order of the given columns.

Parameters

array $columnsNames

Return Value

bool

Column addColumn($columnName, $typeName, array $options = array())

Parameters

$columnName
$typeName
array $options

Return Value

Column

Table renameColumn(string $oldColumnName, string $newColumnName)

Rename Column

Parameters

string $oldColumnName
string $newColumnName

Return Value

Table

Table changeColumn(string $columnName, array $options)

Change Column Details

Parameters

string $columnName
array $options

Return Value

Table

Table dropColumn(string $columnName)

Drop Column from Table

Parameters

string $columnName

Return Value

Table

Table addForeignKeyConstraint($foreignTable, array $localColumnNames, array $foreignColumnNames, array $options = array(), $constraintName = null)

Add a foreign key constraint

Name is inferred from the local columns

Parameters

$foreignTable
array $localColumnNames
array $foreignColumnNames
array $options
$constraintName

Return Value

Table

Table addUnnamedForeignKeyConstraint($foreignTable, array $localColumnNames, array $foreignColumnNames, array $options = array()) deprecated

deprecated Use {@link addForeignKeyConstraint}

Add a foreign key constraint

Name is to be generated by the database itsself.

Parameters

$foreignTable
array $localColumnNames
array $foreignColumnNames
array $options

Return Value

Table

Table addNamedForeignKeyConstraint($name, $foreignTable, array $localColumnNames, array $foreignColumnNames, array $options = array()) deprecated

deprecated Use {@link addForeignKeyConstraint}

Add a foreign key constraint with a given name

Parameters

$name
$foreignTable
array $localColumnNames
array $foreignColumnNames
array $options

Return Value

Table

Table addOption(string $name, string $value)

Parameters

string $name
string $value

Return Value

Table

protected _addColumn(Column $column)

Parameters

Column $column

protected Table _addIndex(Index $indexCandidate)

Add index to table

Parameters

Index $indexCandidate

Return Value

Table

protected _addForeignKeyConstraint(ForeignKeyConstraint $constraint)

Parameters

ForeignKeyConstraint $constraint

bool hasForeignKey(string $constraintName)

Does Table have a foreign key constraint with the given name? *

Parameters

string $constraintName

Return Value

bool

ForeignKeyConstraint getForeignKey(string $constraintName)

Parameters

string $constraintName

Return Value

ForeignKeyConstraint

removeForeignKey($constraintName)

Parameters

$constraintName

Column[] getColumns()

Return Value

Column[]

bool hasColumn(string $columnName)

Does this table have a column with the given name?

Parameters

string $columnName

Return Value

bool

Column getColumn(string $columnName)

Get a column instance

Parameters

string $columnName

Return Value

Column

Index|null getPrimaryKey()

Return Value

Index|null

getPrimaryKeyColumns()

bool hasPrimaryKey()

Check if this table has a primary key.

Return Value

bool

bool hasIndex(string $indexName)

Parameters

string $indexName

Return Value

bool

Index getIndex(string $indexName)

Parameters

string $indexName

Return Value

Index

array getIndexes()

Return Value

array

array getForeignKeys()

Get Constraints

Return Value

array

hasOption($name)

Parameters

$name

getOption($name)

Parameters

$name

getOptions()

visit(Visitor $visitor)

Parameters

Visitor $visitor

__clone()

Clone of a Table triggers a deep clone of all affected assets