Index
extends AbstractAsset
in package
implements
Constraint
The abstract asset allows to reset the name of all assets without publishing this to the public userland.
This encapsulation hack is necessary to keep a consistent state of the database schema. Say we have a list of tables array($tableName => Table($tableName)); if you want to rename the table, you have to make sure
Table of Contents
Interfaces
- Constraint
- Marker interface for constraints.
Properties
- $_columns : array<string|int, Identifier>
- Asset identifier instances of the column names the index is associated with.
- $_flags : array<string|int, true>
- Platform specific flags for indexes.
- $_isPrimary : bool
- $_isUnique : bool
- $_name : string
- $_namespace : string|null
- Namespace of the asset. If none isset the default namespace is assumed.
- $_quoted : bool
- $options : array<string|int, mixed>
- Platform specific options
Methods
- __construct() : mixed
- addFlag() : Index
- Adds Flag for an index that translates to platform specific handling.
- getColumns() : array<string|int, string>
- Returns the names of the referencing table columns the constraint is associated with.
- getFlags() : array<string|int, string>
- Returns platform specific flags for indexes.
- getFullQualifiedName() : string
- The normalized name is full-qualified and lower-cased. Lower-casing 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.
- getName() : string
- Returns the name of this schema asset.
- getNamespaceName() : string|null
- Gets the namespace name of this asset.
- getOption() : mixed
- getOptions() : array<string|int, mixed>
- getQuotedColumns() : array<string|int, string>
- Returns the quoted representation of the column names the constraint is associated with.
- getQuotedName() : string
- Gets the quoted representation of this asset but only if it was defined with one. Otherwise return the plain unquoted value as inserted.
- getShortestName() : string
- The shortest name is stripped of the default namespace. All other namespaced elements are returned as full-qualified names.
- getUnquotedColumns() : array<string|int, string>
- hasColumnAtPosition() : bool
- hasFlag() : bool
- Does this index have a specific flag?
- hasOption() : bool
- isFulfilledBy() : bool
- Checks if the other index already fulfills all the indexing and constraint needs of the current one.
- isFullfilledBy() : bool
- Keeping misspelled function name for backwards compatibility
- isInDefaultNamespace() : bool
- Is this asset in the default namespace?
- isPrimary() : bool
- isQuoted() : bool
- Checks if this asset's name is quoted.
- isSimpleIndex() : bool
- Is the index neither unique nor primary key?
- isUnique() : bool
- overrules() : bool
- Detects if the other index is a non-unique, non primary index that can be overwritten by this one.
- removeFlag() : void
- Removes a flag.
- spansColumns() : bool
- Checks if this index exactly spans the given column names in the correct order.
- _addColumn() : void
- _generateIdentifierName() : string
- Generates an identifier from a list of column names obeying a certain string length.
- _setName() : void
- Sets the name of this asset.
- isIdentifierQuoted() : bool
- Checks if this identifier is quoted.
- trimQuotes() : string
- Trim quotes from the identifier.
- hasSameColumnLengths() : bool
- Returns whether the index has the same column lengths as the other
- samePartialIndex() : bool
- Return whether the two indexes have the same partial index
Properties
$_columns
Asset identifier instances of the column names the index is associated with.
protected
array<string|int, Identifier>
$_columns
= []
array($columnName => Identifier)
$_flags
Platform specific flags for indexes.
protected
array<string|int, true>
$_flags
= []
array($flagName => true)
$_isPrimary
protected
bool
$_isPrimary
= false
$_isUnique
protected
bool
$_isUnique
= false
$_name
protected
string
$_name
= ''
$_namespace
Namespace of the asset. If none isset the default namespace is assumed.
protected
string|null
$_namespace
$_quoted
protected
bool
$_quoted
= false
$options
Platform specific options
private
array<string|int, mixed>
$options
= []
Tags
Methods
__construct()
public
__construct(string $name, array<string|int, string> $columns[, bool $isUnique = false ][, bool $isPrimary = false ][, array<string|int, string> $flags = [] ][, array<string|int, mixed> $options = [] ]) : mixed
Parameters
- $name : string
- $columns : array<string|int, string>
- $isUnique : bool = false
- $isPrimary : bool = false
- $flags : array<string|int, string> = []
- $options : array<string|int, mixed> = []
addFlag()
Adds Flag for an index that translates to platform specific handling.
public
addFlag(string $flag) : Index
Parameters
- $flag : string
Tags
Return values
IndexgetColumns()
Returns the names of the referencing table columns the constraint is associated with.
public
getColumns() : array<string|int, string>
Return values
array<string|int, string>getFlags()
Returns platform specific flags for indexes.
public
getFlags() : array<string|int, string>
Return values
array<string|int, string>getFullQualifiedName()
The normalized name is full-qualified and lower-cased. Lower-casing 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.
public
getFullQualifiedName(string $defaultNamespaceName) : string
Every non-namespaced element is prefixed with the default namespace name which is passed as argument to this method.
Parameters
- $defaultNamespaceName : string
Tags
Return values
stringgetName()
Returns the name of this schema asset.
public
getName() : string
Return values
stringgetNamespaceName()
Gets the namespace name of this asset.
public
getNamespaceName() : string|null
If NULL is returned this means the default namespace is used.
Return values
string|nullgetOption()
public
getOption(string $name) : mixed
Parameters
- $name : string
getOptions()
public
getOptions() : array<string|int, mixed>
Return values
array<string|int, mixed>getQuotedColumns()
Returns the quoted representation of the column names the constraint is associated with.
public
getQuotedColumns(AbstractPlatform $platform) : array<string|int, string>
Parameters
- $platform : AbstractPlatform
-
The platform to use for quotation.
Return values
array<string|int, string>getQuotedName()
Gets the quoted representation of this asset but only if it was defined with one. Otherwise return the plain unquoted value as inserted.
public
getQuotedName(AbstractPlatform $platform) : string
Parameters
- $platform : AbstractPlatform
Return values
stringgetShortestName()
The shortest name is stripped of the default namespace. All other namespaced elements are returned as full-qualified names.
public
getShortestName(string|null $defaultNamespaceName) : string
Parameters
- $defaultNamespaceName : string|null
Return values
stringgetUnquotedColumns()
public
getUnquotedColumns() : array<string|int, string>
Return values
array<string|int, string>hasColumnAtPosition()
public
hasColumnAtPosition(string $name[, int $pos = 0 ]) : bool
Parameters
- $name : string
- $pos : int = 0
Return values
boolhasFlag()
Does this index have a specific flag?
public
hasFlag(string $flag) : bool
Parameters
- $flag : string
Return values
boolhasOption()
public
hasOption(string $name) : bool
Parameters
- $name : string
Return values
boolisFulfilledBy()
Checks if the other index already fulfills all the indexing and constraint needs of the current one.
public
isFulfilledBy(Index $other) : bool
Parameters
- $other : Index
Return values
boolisFullfilledBy()
Keeping misspelled function name for backwards compatibility
public
isFullfilledBy(Index $other) : bool
Parameters
- $other : Index
Tags
Return values
boolisInDefaultNamespace()
Is this asset in the default namespace?
public
isInDefaultNamespace(string $defaultNamespaceName) : bool
Parameters
- $defaultNamespaceName : string
Return values
boolisPrimary()
public
isPrimary() : bool
Return values
boolisQuoted()
Checks if this asset's name is quoted.
public
isQuoted() : bool
Return values
boolisSimpleIndex()
Is the index neither unique nor primary key?
public
isSimpleIndex() : bool
Return values
boolisUnique()
public
isUnique() : bool
Return values
booloverrules()
Detects if the other index is a non-unique, non primary index that can be overwritten by this one.
public
overrules(Index $other) : bool
Parameters
- $other : Index
Return values
boolremoveFlag()
Removes a flag.
public
removeFlag(string $flag) : void
Parameters
- $flag : string
spansColumns()
Checks if this index exactly spans the given column names in the correct order.
public
spansColumns(array<string|int, string> $columnNames) : bool
Parameters
- $columnNames : array<string|int, string>
Return values
bool_addColumn()
protected
_addColumn(string $column) : void
Parameters
- $column : string
Tags
_generateIdentifierName()
Generates an identifier from a list of column names obeying a certain string length.
protected
_generateIdentifierName(array<string|int, string> $columnNames[, string $prefix = '' ][, int $maxSize = 30 ]) : string
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
- $columnNames : array<string|int, string>
- $prefix : string = ''
- $maxSize : int = 30
Return values
string_setName()
Sets the name of this asset.
protected
_setName(string $name) : void
Parameters
- $name : string
isIdentifierQuoted()
Checks if this identifier is quoted.
protected
isIdentifierQuoted(string $identifier) : bool
Parameters
- $identifier : string
Return values
booltrimQuotes()
Trim quotes from the identifier.
protected
trimQuotes(string $identifier) : string
Parameters
- $identifier : string
Return values
stringhasSameColumnLengths()
Returns whether the index has the same column lengths as the other
private
hasSameColumnLengths(self $other) : bool
Parameters
- $other : self
Return values
boolsamePartialIndex()
Return whether the two indexes have the same partial index
private
samePartialIndex(Index $other) : bool
Parameters
- $other : Index