Propel 2 API
Class

Propel\Generator\Model\Unique

class Unique extends Index

Information about unique columns of a table.

This class assumes
that in the underlying RDBMS, unique constraints and unique indices
are roughly equivalent. For example, adding a unique constraint to
a column also creates an index on that column (this is known to be
true for MySQL and Oracle).

Methods

__construct(string $name = null)

Creates a new Index instance.

from Index
boolean isUnique()

Returns whether or not this index is unique.

setName(string $name)

Sets the index name.

from Index
string getName()

Returns the index name.

from Index
setTable(Table $table)

Sets the index parent Table.

from Index
Table getTable()

Returns the index parent table.

from Index
string getTableName()

Returns the name of the index parent table.

from Index
addColumn(mixed $data)

Adds a new column to the index.

from Index
setColumns(array $columns)

Sets an array of columns to use for the index.

from Index
boolean hasColumnSize(string $name)

Returns whether or not there is a size for the specified column.

from Index
integer getColumnSize(string $name)

Returns the size for the specified column.

from Index
resetColumnsSize()

Resets the columns sizes.

from Index
boolean hasColumnAtPosition(integer $pos, string $name, integer $size = null, boolean $caseInsensitive = false)

Returns whether or not this index has a given column at a given position.

from Index
boolean hasColumns()

Returns whether or not the index has columns.

from Index
array getColumns()

Returns the list of local columns.

from Index
appendXml(DOMNode $node)

Appends DOM elements to represent this object in XML.

Details

in Index at line 34
public __construct(string $name = null)

Creates a new Index instance.

Parameters

string $name Name of the index

at line 32
public boolean isUnique()

Returns whether or not this index is unique.

Returns Boolean

Return Value

boolean

in Index at line 61
public setName(string $name)

Sets the index name.

Parameters

string $name

in Index at line 71
public string getName()

Returns the index name.

Return Value

string

in Index at line 105
public setTable(Table $table)

Sets the index parent Table.

Parameters

Table $table

in Index at line 115
public Table getTable()

Returns the index parent table.

Return Value

Table

in Index at line 125
public string getTableName()

Returns the name of the index parent table.

Return Value

string

in Index at line 135
public addColumn(mixed $data)

Adds a new column to the index.

Parameters

mixed $data Column or attributes from XML.

in Index at line 158
public setColumns(array $columns)

Sets an array of columns to use for the index.

Parameters

array $columns

in Index at line 173
public boolean hasColumnSize(string $name)

Returns whether or not there is a size for the specified column.

Parameters

string $name

Return Value

boolean

in Index at line 184
public integer getColumnSize(string $name)

Returns the size for the specified column.

Parameters

string $name

Return Value

integer

in Index at line 194
public resetColumnsSize()

Resets the columns sizes.

This method is useful for generated indices for FKs.

in Index at line 208
public boolean hasColumnAtPosition(integer $pos, string $name, integer $size = null, boolean $caseInsensitive = false)

Returns whether or not this index has a given column at a given position.

Parameters

integer $pos Position in the column list
string $name Column name
integer $size Optional size check
boolean $caseInsensitive Whether or not the comparison is case insensitive (false by default)

Return Value

boolean

in Index at line 237
public boolean hasColumns()

Returns whether or not the index has columns.

Return Value

boolean

in Index at line 249
public array getColumns()

Returns the list of local columns.

You should not edit this list.

Return Value

array

at line 53
public appendXml(DOMNode $node)

Appends DOM elements to represent this object in XML.

Parameters

DOMNode $node