Propel 2 API
Class

Propel\Generator\Model\Column

class Column extends MappingModel

A class for holding data about a column used in an application.

Constants

DEFAULT_TYPE

DEFAULT_VISIBILITY

Properties

static $validVisibilities

Methods

__construct(string $name = null)

Creates a new column and set the name.

loadMapping(array $attributes)

Loads a mapping definition from an array.

from MappingModel
array getAttributes()

Returns all definition attributes.

from MappingModel
mixed getAttribute(string $name, mixed $default = null)

Returns a particular attribute by a case-insensitive name.

from MappingModel
appendXml(DOMNode $node)

Appends DOM elements to represent this object in XML.

VendorInfo addVendorInfo(VendorInfo|array $vendor)

Adds a new VendorInfo instance to this current model object.

from MappingModel
VendorInfo getVendorInfoForType(string $type)

Returns a VendorInfo object by its type.

from MappingModel
string getConfiguredBehavior(string $behavior)

Returns the best class name for a given behavior.

from MappingModel
string toString()

String representation of the current object.

from MappingModel
string __toString()

String representation of the current object.

from MappingModel
Domain getDomain()

Gets domain for this column, creating a new empty domain object if none is set.

setDomain(Domain $domain)

Sets the domain for this column.

string getFullyQualifiedName()

Returns the fully qualified column name (table.column).

string getName()

Returns the column name.

setName(string $name)

Sets the column name.

boolean isNamePlural()

Returns whether or not the column name is plural.

string getSingularName()

Returns the column singular name.

string getDescription()

Returns the column description.

setDescription(string $description)

Sets the column description.

string getPhpName()

Returns the name to use in PHP sources.

setPhpName(string $phpName = null)

Sets the name to use in PHP sources.

string getStudlyPhpName()

Returns the studly version of the PHP name.

string getAccessorVisibility()

Returns the accessor methods visibility of this column / attribute.

setAccessorVisibility(string $visibility)

Sets the accessor methods visibility for this column / attribute.

string getMutatorVisibility()

Returns the mutator methods visibility for this current column.

setMutatorVisibility(string $visibility)

Sets the mutator methods visibility for this column / attribute.

string getConstantName()

Returns the full column constant name (e.g.

string getConstantColumnName()

Returns the column constant name.

string getTableMapName()

Returns the TableMap constant name that will identify this column.

setTableMapName(string $name)

Sets the TableMap constant name that will identify this column.

string getPhpType()

Returns the type to use in PHP sources.

integer getPosition()

Returns the location of this column within the table (one-based).

setPosition(integer $position)

Returns the location of this column within the table (one-based).

setTable(Table $table)

Sets the parent table.

Table getTable()

Returns the parent table.

string getTableName()

Returns the parent table name.

Inheritance addInheritance(Inheritance|array $inheritance)

Adds a new inheritance definition to the inheritance list and sets the parent column of the inheritance to the current column.

array getChildren()

Returns the inheritance definitions.

boolean isInheritance()

Returns whether or not this column is a normal property or specifies a the classes that are represented in the table containing this column.

boolean isEnumeratedClasses()

Returns whether or not possible classes have been enumerated in the schema file.

boolean isNotNull()

Returns whether or not the column is not null.

setNotNull(boolean $notNull)

Sets whether or not the column is not null.

string. getNotNullString()

Returns NOT NULL string for this column.

setPrimaryString(boolean $isPrimaryString)

Sets whether or not the column is used as the primary string.

boolean isPrimaryString()

Returns true if the column is the primary string (used for the magic __toString() method).

setPrimaryKey(boolean $primary)

Sets whether or not the column is a primary key.

boolean isPrimaryKey()

Returns whether or not the column is the primary key.

setNodeKey(boolean $isNodeKey)

Sets whether or not the column is a node key of a tree.

boolean isNodeKey()

Returns whether or not the column is a node key of a tree.

setNodeKeySep(string $sep)

Sets the separator for the node key column in a tree.

string getNodeKeySep()

Returns the node key column separator for a tree.

setNestedSetLeftKey(boolean $isNestedSetLeftKey)

Sets whether or not the column is the nested set left key of a tree.

boolean isNestedSetLeftKey()

Returns whether or not the column is a nested set key of a tree.

setNestedSetRightKey(boolean $isNestedSetRightKey)

Set if the column is the nested set right key of a tree.

boolean isNestedSetRightKey()

Return whether or not the column is a nested set right key of a tree.

setTreeScopeKey(boolean $isTreeScopeKey)

Sets whether or not the column is the scope key of a tree.

boolean isTreeScopeKey()

Returns whether or not the column is a scope key of a tree.

setUnique(boolean $isUnique)

Sets whether or not the column must have a unique index on it.

boolean isUnique()

Returns whether or not the column must have a unique index.

boolean requiresTransactionInPostgres()

Returns true if the column requires a transaction in PostGreSQL.

boolean isForeignKey()

Returns whether or not this column is a foreign key.

boolean hasMultipleFK()

Returns whether or not this column is part of more than one foreign key.

array getForeignKeys()

Returns the foreign key objects for this column.

addReferrer(ForeignKey $fk)

Adds the foreign key from another table that refers to this column.

array getReferrers()

Returns the list of references to this column.

boolean hasReferrers()

Returns whether or not this column has referers.

boolean hasReferrer(ForeignKey $fk)

Returns whether or not this column has a specific referrer for a specific foreign key object.

clearReferrers()

Clears all referrers.

clearInheritanceList()

Clears all inheritance children.

setDomainForType(string $mappingType)

Sets the domain up for specified mapping type.

setType(string $mappingType)

Sets the mapping column type.

string getType()

Returns the Propel column type as a string.

integer getPDOType()

Returns the column PDO type integer for this column's mapping type.

isDefaultSqlType(PlatformInterface $platform = null)

boolean isLobType()

Returns whether or not this column is a blob/lob type.

boolean isTextType()

Returns whether or not this column is a text type.

boolean isNumericType()

Returns whether or not this column is a numeric type.

boolean isBooleanType()

Returns whether or not this column is a boolean type.

boolean isTemporalType()

Returns whether or not this column is a temporal type.

boolean isPhpArrayType()

Returns whether or not the column is an array column.

boolean isEnumType()

Returns whether or not this column is an ENUM column.

setValueSet(array|string $valueSet)

Sets the list of possible values for an ENUM column.

array getValueSet()

Returns the list of possible values for an ENUM column.

integer getSize()

Returns the column size.

setSize(integer $size)

Sets the column size.

integer getScale()

Returns the column scale.

setScale(integer $scale)

Sets the column scale.

getSizeDefinition()

Returns the size and precision in brackets for use in an SQL DLL.

string getDefaultValueString()

Returns a string that will give this column a default value in PHP.

Column setDefaultValue(ColumnDefaultValue|scalar $def)

Sets a string that will give this column a default value.

ColumnDefaultValue getDefaultValue()

Returns the default value object for this column.

mixed getPhpDefaultValue()

Returns the default value suitable for use in PHP.

boolean isAutoIncrement()

Returns whether or the column is an auto increment/sequence value for the target database.

boolean isLazyLoad()

Return whether or not the column has to be lazy loaded.

string getAutoIncrementString()

Returns the auto-increment string.

setAutoIncrement(boolean $isAutoIncrement)

Sets whether or not this column is an auto incremented value.

string getPhpNative()

Returns a string representation of the native PHP type which corresponds to the Propel type of this column.

boolean isPhpPrimitiveType()

Returns whether or not the column PHP native type is primitive type (aka a boolean, an integer, a long, a float, a double or a string).

boolean isPhpPrimitiveNumericType()

Returns whether or not the column PHP native type is a primitive numeric type (aka an integer, a long, a float or a double).

boolean isPhpObjectType()

Returns whether or not the column PHP native type is an object.

PlatformInterface getPlatform()

Returns an instance of PlatformInterface interface.

boolean hasPlatform()

Returns whether or not this column has a platform adapter.

__clone()

Clones the current object.

static string generatePhpName(string $name, string $phpNamingMethod = PhpNameGenerator::CONV_METHOD_CLEAN, string $namePrefix = null)

Returns a generated PHP name.

Details

at line 93
public __construct(string $name = null)

Creates a new column and set the name.

Parameters

string $name

in MappingModel at line 38
public loadMapping(array $attributes)

Loads a mapping definition from an array.

Parameters

array $attributes

in MappingModel at line 58
public array getAttributes()

Returns all definition attributes.

All attribute names (keys) are lowercase.

Return Value

array

in MappingModel at line 73
public mixed getAttribute(string $name, mixed $default = null)

Returns a particular attribute by a case-insensitive name.

If the attribute is not set, then the second default value is
returned instead.

Parameters

string $name
mixed $default

Return Value

mixed

at line 1094
public appendXml(DOMNode $node)

Appends DOM elements to represent this object in XML.

Parameters

DOMNode $node

in MappingModel at line 138
public VendorInfo addVendorInfo(VendorInfo|array $vendor)

Adds a new VendorInfo instance to this current model object.

Parameters

VendorInfo|array $vendor

Return Value

VendorInfo

in MappingModel at line 158
public VendorInfo getVendorInfoForType(string $type)

Returns a VendorInfo object by its type.

Parameters

string $type

Return Value

VendorInfo

in MappingModel at line 176
public string getConfiguredBehavior(string $behavior)

Returns the best class name for a given behavior.

If not found, the method tries to autoload \Propel\Generator\Behavior\[Bname]\[Bname]Behavior

Parameters

string $behavior The behavior name (ie: timestampable)

Return Value

string $class The behavior fully qualified class name

Exceptions

BehaviorNotFoundException

in MappingModel at line 198
public string toString()

String representation of the current object.

Return Value

string

in MappingModel at line 213
public string __toString()

String representation of the current object.

Return Value

string

at line 274
public Domain getDomain()

Gets domain for this column, creating a new empty domain object if none is set.

Return Value

Domain

at line 288
public setDomain(Domain $domain)

Sets the domain for this column.

Parameters

Domain $domain

at line 298
public string getFullyQualifiedName()

Returns the fully qualified column name (table.column).

Return Value

string

at line 308
public string getName()

Returns the column name.

Return Value

string

at line 318
public setName(string $name)

Sets the column name.

Parameters

string $name

at line 328
public boolean isNamePlural()

Returns whether or not the column name is plural.

Return Value

boolean

at line 338
public string getSingularName()

Returns the column singular name.

Return Value

string

at line 348
public string getDescription()

Returns the column description.

Return Value

string

at line 358
public setDescription(string $description)

Sets the column description.

Parameters

string $description

at line 369
public string getPhpName()

Returns the name to use in PHP sources.

It will set & return
a self-generated phpName from it's name if it's not already set.

Return Value

string

at line 386
public setPhpName(string $phpName = null)

Sets the name to use in PHP sources.

It will generate a phpName from it's name if no
$phpName is passed.

Parameters

string $phpName

at line 402
public string getStudlyPhpName()

Returns the studly version of the PHP name.

The studly name is the PHP name with the first character lowercase.

Return Value

string

at line 412
public string getAccessorVisibility()

Returns the accessor methods visibility of this column / attribute.

Return Value

string

at line 426
public setAccessorVisibility(string $visibility)

Sets the accessor methods visibility for this column / attribute.

Parameters

string $visibility

at line 441
public string getMutatorVisibility()

Returns the mutator methods visibility for this current column.

Return Value

string

at line 455
public setMutatorVisibility(string $visibility)

Sets the mutator methods visibility for this column / attribute.

Parameters

string $visibility

at line 470
public string getConstantName()

Returns the full column constant name (e.g.

TableMapName::COLUMN_NAME).

Return Value

string A column constant name for insertion into PHP code

at line 483
public string getConstantColumnName()

Returns the column constant name.

Return Value

string

at line 498
public string getTableMapName()

Returns the TableMap constant name that will identify this column.

Return Value

string

at line 508
public setTableMapName(string $name)

Sets the TableMap constant name that will identify this column.

Parameters

string $name

at line 520
public string getPhpType()

Returns the type to use in PHP sources.

If no types has been specified, then use result of getPhpNative().

Return Value

string

at line 530
public integer getPosition()

Returns the location of this column within the table (one-based).

Return Value

integer

at line 540
public setPosition(integer $position)

Returns the location of this column within the table (one-based).

Parameters

integer $position

at line 550
public setTable(Table $table)

Sets the parent table.

Parameters

Table $table

at line 560
public Table getTable()

Returns the parent table.

Return Value

Table

at line 570
public string getTableName()

Returns the parent table name.

Return Value

string

at line 582
public Inheritance addInheritance(Inheritance|array $inheritance)

Adds a new inheritance definition to the inheritance list and sets the parent column of the inheritance to the current column.

Parameters

Inheritance|array $inheritance

Return Value

Inheritance

at line 606
public array getChildren()

Returns the inheritance definitions.

Return Value

array

at line 617
public boolean isInheritance()

Returns whether or not this column is a normal property or specifies a the classes that are represented in the table containing this column.

Return Value

boolean

at line 628
public boolean isEnumeratedClasses()

Returns whether or not possible classes have been enumerated in the schema file.

Return Value

boolean

at line 638
public boolean isNotNull()

Returns whether or not the column is not null.

Return Value

boolean

at line 648
public setNotNull(boolean $notNull)

Sets whether or not the column is not null.

Parameters

boolean $notNull

at line 658
public string. getNotNullString()

Returns NOT NULL string for this column.

Return Value

string.

at line 671
public setPrimaryString(boolean $isPrimaryString)

Sets whether or not the column is used as the primary string.

The primary string is the value used by default in the magic
__toString method of an active record object.

Parameters

boolean $isPrimaryString

at line 682
public boolean isPrimaryString()

Returns true if the column is the primary string (used for the magic __toString() method).

Return Value

boolean

at line 692
public setPrimaryKey(boolean $primary)

Sets whether or not the column is a primary key.

Parameters

boolean $primary

at line 702
public boolean isPrimaryKey()

Returns whether or not the column is the primary key.

Return Value

boolean

at line 712
public setNodeKey(boolean $isNodeKey)

Sets whether or not the column is a node key of a tree.

Parameters

boolean $isNodeKey

at line 722
public boolean isNodeKey()

Returns whether or not the column is a node key of a tree.

Return Value

boolean

at line 732
public setNodeKeySep(string $sep)

Sets the separator for the node key column in a tree.

Parameters

string $sep

at line 742
public string getNodeKeySep()

Returns the node key column separator for a tree.

Return Value

string

at line 752
public setNestedSetLeftKey(boolean $isNestedSetLeftKey)

Sets whether or not the column is the nested set left key of a tree.

Parameters

boolean $isNestedSetLeftKey

at line 762
public boolean isNestedSetLeftKey()

Returns whether or not the column is a nested set key of a tree.

Return Value

boolean

at line 772
public setNestedSetRightKey(boolean $isNestedSetRightKey)

Set if the column is the nested set right key of a tree.

Parameters

boolean $isNestedSetRightKey

at line 782
public boolean isNestedSetRightKey()

Return whether or not the column is a nested set right key of a tree.

Return Value

boolean

at line 792
public setTreeScopeKey(boolean $isTreeScopeKey)

Sets whether or not the column is the scope key of a tree.

Parameters

boolean $isTreeScopeKey

at line 802
public boolean isTreeScopeKey()

Returns whether or not the column is a scope key of a tree.

Return Value

boolean

at line 812
public setUnique(boolean $isUnique)

Sets whether or not the column must have a unique index on it.

Parameters

boolean $isUnique

at line 822
public boolean isUnique()

Returns whether or not the column must have a unique index.

Return Value

boolean

at line 832
public boolean requiresTransactionInPostgres()

Returns true if the column requires a transaction in PostGreSQL.

Return Value

boolean

at line 842
public boolean isForeignKey()

Returns whether or not this column is a foreign key.

Return Value

boolean

at line 852
public boolean hasMultipleFK()

Returns whether or not this column is part of more than one foreign key.

Return Value

boolean

at line 864
public array getForeignKeys()

Returns the foreign key objects for this column.

Only if it is a foreign key or part of a foreign key.

Return Value

array

at line 874
public addReferrer(ForeignKey $fk)

Adds the foreign key from another table that refers to this column.

Parameters

ForeignKey $fk

at line 888
public array getReferrers()

Returns the list of references to this column.

Return Value

array

at line 902
public boolean hasReferrers()

Returns whether or not this column has referers.

Return Value

boolean

at line 914
public boolean hasReferrer(ForeignKey $fk)

Returns whether or not this column has a specific referrer for a specific foreign key object.

Parameters

ForeignKey $fk

Return Value

boolean

at line 923
public clearReferrers()

Clears all referrers.

at line 932
public clearInheritanceList()

Clears all inheritance children.

at line 945
public setDomainForType(string $mappingType)

Sets the domain up for specified mapping type.

Calling this method will implicitly overwrite any previously set type,
size, scale (or other domain attributes).

Parameters

string $mappingType

at line 956
public setType(string $mappingType)

Sets the mapping column type.

Parameters

string $mappingType

See also

Domain::setType()

at line 971
public string getType()

Returns the Propel column type as a string.

Return Value

string

See also

Domain::getType()

at line 981
public integer getPDOType()

Returns the column PDO type integer for this column's mapping type.

Return Value

integer

at line 986
public isDefaultSqlType(PlatformInterface $platform = null)

Parameters

PlatformInterface $platform

at line 1004
public boolean isLobType()

Returns whether or not this column is a blob/lob type.

Return Value

boolean

at line 1014
public boolean isTextType()

Returns whether or not this column is a text type.

Return Value

boolean

at line 1024
public boolean isNumericType()

Returns whether or not this column is a numeric type.

Return Value

boolean

at line 1034
public boolean isBooleanType()

Returns whether or not this column is a boolean type.

Return Value

boolean

at line 1044
public boolean isTemporalType()

Returns whether or not this column is a temporal type.

Return Value

boolean

at line 1054
public boolean isPhpArrayType()

Returns whether or not the column is an array column.

Return Value

boolean

at line 1064
public boolean isEnumType()

Returns whether or not this column is an ENUM column.

Return Value

boolean

at line 1074
public setValueSet(array|string $valueSet)

Sets the list of possible values for an ENUM column.

Parameters

array|string $valueSet

at line 1089
public array getValueSet()

Returns the list of possible values for an ENUM column.

Return Value

array

at line 1172
public integer getSize()

Returns the column size.

Return Value

integer

at line 1182
public setSize(integer $size)

Sets the column size.

Parameters

integer $size

at line 1192
public integer getScale()

Returns the column scale.

Return Value

integer

at line 1202
public setScale(integer $scale)

Sets the column scale.

Parameters

integer $scale

at line 1214
public getSizeDefinition()

Returns the size and precision in brackets for use in an SQL DLL.

Example: (size[,scale]) <-> (10) or (10,2)

return string

at line 1224
public string getDefaultValueString()

Returns a string that will give this column a default value in PHP.

Return Value

string

at line 1253
public Column setDefaultValue(ColumnDefaultValue|scalar $def)

Sets a string that will give this column a default value.

Parameters

ColumnDefaultValue|scalar $def column default value

Return Value

Column

at line 1270
public ColumnDefaultValue getDefaultValue()

Returns the default value object for this column.

Return Value

ColumnDefaultValue

See also

Domain::getDefaultValue()

at line 1281
public mixed getPhpDefaultValue()

Returns the default value suitable for use in PHP.

Return Value

mixed

See also

Domain::getPhpDefaultValue()

at line 1293
public boolean isAutoIncrement()

Returns whether or the column is an auto increment/sequence value for the target database.

We need to pass in the properties for the target
database!

Return Value

boolean

at line 1306
public boolean isLazyLoad()

Return whether or not the column has to be lazy loaded.

For example, if a runtime query on the table doesn't hydrate this column
but a getter does.

Return Value

boolean

at line 1316
public string getAutoIncrementString()

Returns the auto-increment string.

Return Value

string

at line 1340
public setAutoIncrement(boolean $isAutoIncrement)

Sets whether or not this column is an auto incremented value.

Use isAutoIncrement() to find out if it is set or not.

Parameters

boolean $isAutoIncrement

at line 1352
public string getPhpNative()

Returns a string representation of the native PHP type which corresponds to the Propel type of this column.

Used in the generation of Base
objects.

Return Value

string

at line 1364
public boolean isPhpPrimitiveType()

Returns whether or not the column PHP native type is primitive type (aka a boolean, an integer, a long, a float, a double or a string).

Return Value

boolean

See also

PropelTypes::isPhpPrimitiveType()

at line 1376
public boolean isPhpPrimitiveNumericType()

Returns whether or not the column PHP native type is a primitive numeric type (aka an integer, a long, a float or a double).

Return Value

boolean

See also

PropelTypes::isPhpPrimitiveNumericType()

at line 1387
public boolean isPhpObjectType()

Returns whether or not the column PHP native type is an object.

Return Value

boolean

See also

PropelTypes::isPhpObjectType()

at line 1397
public PlatformInterface getPlatform()

Returns an instance of PlatformInterface interface.

Return Value

PlatformInterface

at line 1407
public boolean hasPlatform()

Returns whether or not this column has a platform adapter.

Return Value

boolean

at line 1420
public __clone()

Clones the current object.

at line 1433
static public string generatePhpName(string $name, string $phpNamingMethod = PhpNameGenerator::CONV_METHOD_CLEAN, string $namePrefix = null)

Returns a generated PHP name.

Parameters

string $name
string $phpNamingMethod
string $namePrefix

Return Value

string