Documentation

UniqueConstraint extends AbstractAsset
in package
implements Constraint

Class for a unique constraint.

Table of Contents

Interfaces

Constraint
Marker interface for constraints.

Properties

$_name  : string
$_namespace  : string|null
Namespace of the asset. If none isset the default namespace is assumed.
$_quoted  : bool
$columns  : array<string|int, Identifier>
Asset identifier instances of the column names the unique constraint is associated with.
$flags  : array<string|int, true>
Platform specific flags.
$options  : array<string|int, mixed>
Platform specific options.

Methods

__construct()  : mixed
addFlag()  : $this
Adds flag for a unique constraint 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 unique constraint.
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>
hasFlag()  : bool
Does this unique constraint have a specific flag?
hasOption()  : bool
Does this unique constraint have a specific option?
isInDefaultNamespace()  : bool
Is this asset in the default namespace?
isQuoted()  : bool
Checks if this asset's name is quoted.
removeFlag()  : void
Removes a flag.
_generateIdentifierName()  : string
Generates an identifier from a list of column names obeying a certain string length.
_setName()  : void
Sets the name of this asset.
addColumn()  : void
Adds a new column to the unique constraint.
isIdentifierQuoted()  : bool
Checks if this identifier is quoted.
trimQuotes()  : string
Trim quotes from the identifier.

Properties

$_namespace

Namespace of the asset. If none isset the default namespace is assumed.

protected string|null $_namespace

$columns

Asset identifier instances of the column names the unique constraint is associated with.

protected array<string|int, Identifier> $columns = []

array($columnName => Identifier)

$flags

Platform specific flags.

protected array<string|int, true> $flags = []

array($flagName => true)

$options

Platform specific options.

private array<string|int, mixed> $options

Methods

__construct()

public __construct(string $name, array<string|int, string> $columns[, array<string|int, string> $flags = [] ][, array<string|int, mixed> $options = [] ]) : mixed
Parameters
$name : string
$columns : array<string|int, string>
$flags : array<string|int, string> = []
$options : array<string|int, mixed> = []

addFlag()

Adds flag for a unique constraint that translates to platform specific handling.

public addFlag(string $flag) : $this
Parameters
$flag : string
Tags
example

$uniqueConstraint->addFlag('CLUSTERED')

Return values
$this

getColumns()

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 unique constraint.

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
deprecated

Use getNamespaceName() and getName() instead.

Return values
string

getName()

Returns the name of this schema asset.

public getName() : string
Return values
string

getNamespaceName()

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|null

getOption()

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
string

getShortestName()

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
string

getUnquotedColumns()

public getUnquotedColumns() : array<string|int, string>
Return values
array<string|int, string>

hasFlag()

Does this unique constraint have a specific flag?

public hasFlag(string $flag) : bool
Parameters
$flag : string
Return values
bool

hasOption()

Does this unique constraint have a specific option?

public hasOption(string $name) : bool
Parameters
$name : string
Return values
bool

isInDefaultNamespace()

Is this asset in the default namespace?

public isInDefaultNamespace(string $defaultNamespaceName) : bool
Parameters
$defaultNamespaceName : string
Return values
bool

isQuoted()

Checks if this asset's name is quoted.

public isQuoted() : bool
Return values
bool

removeFlag()

Removes a flag.

public removeFlag(string $flag) : void
Parameters
$flag : string

_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

addColumn()

Adds a new column to the unique constraint.

protected addColumn(string $column) : void
Parameters
$column : string

isIdentifierQuoted()

Checks if this identifier is quoted.

protected isIdentifierQuoted(string $identifier) : bool
Parameters
$identifier : string
Return values
bool

trimQuotes()

Trim quotes from the identifier.

protected trimQuotes(string $identifier) : string
Parameters
$identifier : string
Return values
string

        
On this page

Search results