Propel API
Class

Column

class Column extends XMLElement

A Class for holding data about a column used in an Application.

Constants

DEFAULT_TYPE

DEFAULT_VISIBILITY

Properties

static $valid_visibilities

Methods

loadFromXML(array $attributes)

This is the entry point method for loading data from XML.

from XMLElement
array getAttributes()

Returns the assoc array of attributes.

from XMLElement
mixed getAttribute(string $name, mixed $defaultValue = null)

Gets a particular attribute by [case-insensitive] name.

from XMLElement
appendXml(DOMNode $node)

VendorInfo addVendorInfo(mixed $data)

Sets an associated VendorInfo object.

from XMLElement
VendorInfo getVendorInfoForType($type)

Gets the any associated VendorInfo object.

from XMLElement
string getConfiguredBehavior(string $bname)

Find the best class name for a given behavior Looks in build.properties for path like propel.behavior.[bname].class If not found, tries to autoload [Bname]Behavior If no success, returns 'Behavior'

from XMLElement
toString()

String representation of the current object.

from XMLElement
__toString()

Magic string method

from XMLElement
__construct($name = null)

Creates a new column and set the name

static string makeList($columns, PropelPlatformInterface $platform)

Return a comma delimited string listing the specified columns.

Domain getDomain()

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

setDomain(Domain $domain)

Sets domain for this column

getFullyQualifiedName()

Returns table.column

getName()

Get the name of the column

setName($newName)

Set the name of the column

isNamePlural()

Determines whether a column name is plural

getSingularName()

Gets the singular name for the column

getDescription()

Get the description for the Table

setDescription($newDescription)

Set the description for the Table

string getPhpName()

Get name to use in PHP sources.

setPhpName(String $phpName = null)

Set name to use in PHP sources.

string getStudlyPhpName()

Get studly version of PHP name.

string getAccessorVisibility()

Get the visibility of the accessors of this column / attribute

setAccessorVisibility($newVisibility $newVisibility)

Set the visibility of the accessor methods for this column / attribute

string getMutatorVisibility()

Get the visibility of the mutator of this column / attribute

setMutatorVisibility($newVisibility $newVisibility)

Set the visibility of the mutator methods for this column / attribute

string getConstantName()

Get the column constant name (e.g.

getConstantColumnName()

string getPeerName()

Get the Peer constant name that will identify this column.

setPeerName($name $name)

Set the Peer constant name that will identify this column.

string getPhpType()

Get type to use in PHP sources.

int getPosition()

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

setPosition(int $v)

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

setTable(Table $parent)

Set the parent Table of the column

getTable()

Get the parent Table of the column

getTableName()

Returns the Name of the table the column is in

Inheritance addInheritance(Inheritance|string $inhdata)

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

getChildren()

Get the inheritance definitions.

isInheritance()

Determine if this column is a normal property or specifies a the classes that are represented in the table containing this column.

isEnumeratedClasses()

Determine if possible classes have been enumerated in the xml file.

isNotNull()

Return the isNotNull property of the column

setNotNull($status)

Set the isNotNull property of the column

"NOT getNotNullString()

Return NOT NULL String for this column

setPrimaryString(boolean $v)

Set whether the column is the primary string, i.e.

isPrimaryString()

Return true if the column is the primary string, i.e.

setPrimaryKey(boolean $v)

Set whether the column is a primary key or not.

isPrimaryKey()

Return true if the column is a primary key

setNodeKey($nk)

Set if the column is the node key of a tree

isNodeKey()

Return true if the column is a node key of a tree

setNodeKeySep($sep)

Set if the column is the node key of a tree

getNodeKeySep()

Return true if the column is a node key of a tree

setNestedSetLeftKey($nslk)

Set if the column is the nested set left key of a tree

isNestedSetLeftKey()

Return true if the column is a nested set key of a tree

setNestedSetRightKey($nsrk)

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

isNestedSetRightKey()

Return true if the column is a nested set right key of a tree

setTreeScopeKey($tsk)

Set if the column is the scope key of a tree

boolean isTreeScopeKey()

Return true if the column is a scope key of a tree

setUnique(boolean $u)

Set true if the column is UNIQUE

boolean isUnique()

Get the UNIQUE property.

boolean requiresTransactionInPostgres()

Return true if the column requires a transaction in Postgres

boolean isForeignKey()

Utility method to determine if this column is a foreign key.

boolean hasMultipleFK()

Whether this column is a part of more than one foreign key.

array getForeignKeys()

Get the foreign key objects for this column (if it is a foreign key or part of a foreign key)

addReferrer(ForeignKey $fk)

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

getReferrers()

Get list of references to this column.

hasReferrers()

hasReferrer(ForeignKey $fk)

clearReferrers()

clearInheritanceList()

setDomainForType(string $propelType)

Sets the domain up for specified Propel type.

setType(string $propelType)

Sets the propel colunm type.

string getType()

Returns the Propel column type as a string.

int getPDOType()

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

getPropelType()

Returns the column type as given in the schema as an object

isDefaultSqlType(PropelPlatformInterface $platform = null)

boolean isLobType()

Utility method to know whether column needs Blob/Lob handling.

isTextType()

Utility method to see if the column is text type.

boolean isNumericType()

Utility method to see if the column is numeric type.

boolean isBooleanType()

Utility method to see if the column is boolean type.

boolean isTemporalType()

Utility method to know whether column is a temporal column.

boolean isPhpArrayType()

Utility method to know whether column is an array column.

boolean isEnumType()

Utility method to know whether column is an ENUM column.

setValueSet(array $valueSet)

Sets the list of possible values for an ENUM column

array getValueSet()

Returns the list of possible values for an ENUM column

string getSize()

Returns the size of the column

setSize(string $newSize)

Set the size of the column

string getScale()

Returns the scale of the column

setScale(string $newScale)

Set the scale of the column

printSize()

Return the size in brackets for use in an sql schema if the type is String.

string getDefaultSetting()

Return a string that will give this column a default value in SQL

string getDefaultValueString()

Return a string that will give this column a default value in PHP

Column setDefaultValue(ColumnDefaultValue|int|float|bool|string $def)

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

ColumnDefaultValue getDefaultValue()

Get the default value object for this column.

mixed getPhpDefaultValue()

Get the default value suitable for use in PHP.

isAutoIncrement()

Return auto increment/sequence string for the target database.

isLazyLoad()

Return true if the columns has to be lazy loaded, i.e.

string getAutoIncrementString()

Gets the auto-increment string.

setAutoIncrement($value)

Set the auto increment value.

setTypeFromString($typeName, $size)

Set the column type from a string property (normally a string from an sql input file)

string getPhpNative()

Return a string representation of the native PHP type which corresponds to the propel type of this column.

boolean isPhpPrimitiveType()

Returns true if the column's PHP native type is an boolean, int, long, float, double, string.

boolean isPhpPrimitiveNumericType()

Return true if column's PHP native type is an boolean, int, long, float, double.

boolean isPhpObjectType()

Returns true if the column's PHP native type is a class name.

Platform getPlatform()

Get the platform/adapter impl.

hasPlatform()

getValidator()

__clone()

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

Details

in XMLElement at line 47
public loadFromXML(array $attributes)

This is the entry point method for loading data from XML.

It calls a setupObject() method that must be implemented by the child class.

Parameters

array $attributes The attributes for the XML tag.

in XMLElement at line 58
public array getAttributes()

Returns the assoc array of attributes.

All attribute names (keys) are lowercase.

Return Value

array

in XMLElement at line 70
public mixed getAttribute(string $name, mixed $defaultValue = null)

Gets a particular attribute by [case-insensitive] name.

If attribute is not set then the $defaultValue is returned.

Parameters

string $name The [case-insensitive] name of the attribute to lookup.
mixed $defaultValue The default value to use in case the attribute is not set.

Return Value

mixed The value of the attribute or $defaultValue if not set.

at line 992
public appendXml(DOMNode $node)

Parameters

DOMNode $node

in XMLElement at line 127
public VendorInfo addVendorInfo(mixed $data)

Sets an associated VendorInfo object.

Parameters

mixed $data VendorInfo object or XML attrib data (array)

Return Value

VendorInfo

in XMLElement at line 146
public VendorInfo getVendorInfoForType($type)

Gets the any associated VendorInfo object.

Parameters

$type

Return Value

VendorInfo

in XMLElement at line 166
public string getConfiguredBehavior(string $bname)

Find the best class name for a given behavior Looks in build.properties for path like propel.behavior.[bname].class If not found, tries to autoload [Bname]Behavior If no success, returns 'Behavior'

Parameters

string $bname behavior name, e.g. 'timestampable'

Return Value

string behavior class name, e.g. 'TimestampableBehavior'

Exceptions

InvalidArgumentException

in XMLElement at line 189
public toString()

String representation of the current object.

This is an xml representation with the XML declaration removed.

See also

appendXml()

in XMLElement at line 203
public __toString()

Magic string method

See also

toString()

at line 105
public __construct($name = null)

Creates a new column and set the name

Parameters

$name

at line 119
static public string makeList($columns, PropelPlatformInterface $platform)

Return a comma delimited string listing the specified columns.

Parameters

$columns
PropelPlatformInterface $platform

Return Value

string

at line 271
public Domain getDomain()

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

Return Value

Domain

at line 284
public setDomain(Domain $domain)

Sets domain for this column

Parameters

Domain $domain

at line 292
public getFullyQualifiedName()

Returns table.column

at line 300
public getName()

Get the name of the column

at line 308
public setName($newName)

Set the name of the column

Parameters

$newName

at line 316
public isNamePlural()

Determines whether a column name is plural

at line 324
public getSingularName()

Gets the singular name for the column

at line 332
public getDescription()

Get the description for the Table

at line 342
public setDescription($newDescription)

Set the description for the Table

Parameters

$newDescription

at line 353
public string getPhpName()

Get 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 370
public setPhpName(String $phpName = null)

Set name to use in PHP sources.

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

Parameters

String $phpName PhpName to be set

at line 386
public string getStudlyPhpName()

Get studly version of PHP name.

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

Return Value

string

at line 401
public string getAccessorVisibility()

Get the visibility of the accessors of this column / attribute

Return Value

string

at line 414
public setAccessorVisibility($newVisibility $newVisibility)

Set the visibility of the accessor methods for this column / attribute

Parameters

$newVisibility $newVisibility string

at line 428
public string getMutatorVisibility()

Get the visibility of the mutator of this column / attribute

Return Value

string

at line 441
public setMutatorVisibility($newVisibility $newVisibility)

Set the visibility of the mutator methods for this column / attribute

Parameters

$newVisibility $newVisibility string

at line 456
public string getConstantName()

Get the column constant name (e.g.

PeerName::COLUMN_NAME).

Return Value

string A column constant name for insertion into PHP code

at line 464
public getConstantColumnName()

at line 478
public string getPeerName()

Get the Peer constant name that will identify this column.

Return Value

string

at line 487
public setPeerName($name $name)

Set the Peer constant name that will identify this column.

Parameters

$name $name string

at line 500
public string getPhpType()

Get type to use in PHP sources.

If no type has been specified, then uses results of getPhpNative().

Return Value

string The type name.

at line 513
public int getPosition()

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

Return Value

int value of position.

at line 522
public setPosition(int $v)

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

Parameters

int $v Value to assign to position.

at line 530
public setTable(Table $parent)

Set the parent Table of the column

Parameters

Table $parent

at line 538
public getTable()

Get the parent Table of the column

at line 546
public getTableName()

Returns the Name of the table the column is in

at line 558
public Inheritance addInheritance(Inheritance|string $inhdata)

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

Parameters

Inheritance|string $inhdata Inheritance or XML data.

Return Value

Inheritance

at line 581
public getChildren()

Get the inheritance definitions.

at line 590
public isInheritance()

Determine if this column is a normal property or specifies a the classes that are represented in the table containing this column.

at line 598
public isEnumeratedClasses()

Determine if possible classes have been enumerated in the xml file.

at line 606
public isNotNull()

Return the isNotNull property of the column

at line 614
public setNotNull($status)

Set the isNotNull property of the column

Parameters

$status

at line 624
public "NOT getNotNullString()

Return NOT NULL String for this column

Return Value

"NOT NULL" if null values are not allowed or an empty string.

at line 634
public setPrimaryString(boolean $v)

Set whether the column is the primary string, i.e.

whether its value is the default string representation of the table

Parameters

boolean $v

at line 643
public isPrimaryString()

Return true if the column is the primary string, i.e.

if its value is the default string representation of the table

at line 652
public setPrimaryKey(boolean $v)

Set whether the column is a primary key or not.

Parameters

boolean $v

at line 660
public isPrimaryKey()

Return true if the column is a primary key

at line 668
public setNodeKey($nk)

Set if the column is the node key of a tree

Parameters

$nk

at line 676
public isNodeKey()

Return true if the column is a node key of a tree

at line 684
public setNodeKeySep($sep)

Set if the column is the node key of a tree

Parameters

$sep

at line 692
public getNodeKeySep()

Return true if the column is a node key of a tree

at line 700
public setNestedSetLeftKey($nslk)

Set if the column is the nested set left key of a tree

Parameters

$nslk

at line 708
public isNestedSetLeftKey()

Return true if the column is a nested set key of a tree

at line 716
public setNestedSetRightKey($nsrk)

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

Parameters

$nsrk

at line 724
public isNestedSetRightKey()

Return true if the column is a nested set right key of a tree

at line 732
public setTreeScopeKey($tsk)

Set if the column is the scope key of a tree

Parameters

$tsk

at line 741
public boolean isTreeScopeKey()

Return true if the column is a scope key of a tree

Return Value

boolean

at line 750
public setUnique(boolean $u)

Set true if the column is UNIQUE

Parameters

boolean $u

at line 759
public boolean isUnique()

Get the UNIQUE property.

Return Value

boolean

at line 768
public boolean requiresTransactionInPostgres()

Return true if the column requires a transaction in Postgres

Return Value

boolean

at line 777
public boolean isForeignKey()

Utility method to determine if this column is a foreign key.

Return Value

boolean

at line 786
public boolean hasMultipleFK()

Whether this column is a part of more than one foreign key.

Return Value

boolean

at line 795
public array getForeignKeys()

Get the foreign key objects for this column (if it is a foreign key or part of a foreign key)

Return Value

array

at line 803
public addReferrer(ForeignKey $fk)

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

Parameters

ForeignKey $fk

at line 814
public getReferrers()

Get list of references to this column.

at line 823
public hasReferrers()

at line 828
public hasReferrer(ForeignKey $fk)

Parameters

ForeignKey $fk

at line 833
public clearReferrers()

at line 838
public clearInheritanceList()

at line 851
public setDomainForType(string $propelType)

Sets the domain up for specified Propel type.

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

Parameters

string $propelType

at line 861
public setType(string $propelType)

Sets the propel colunm type.

Parameters

string $propelType

at line 874
public string getType()

Returns the Propel column type as a string.

Return Value

string The constant representing Propel type: e.g. "VARCHAR".

at line 883
public int getPDOType()

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

Return Value

int The integer value representing PDO type param: e.g. PDO::PARAM_INT

at line 891
public getPropelType()

Returns the column type as given in the schema as an object

at line 896
public isDefaultSqlType(PropelPlatformInterface $platform = null)

Parameters

PropelPlatformInterface $platform

at line 913
public boolean isLobType()

Utility method to know whether column needs Blob/Lob handling.

Return Value

boolean

at line 921
public isTextType()

Utility method to see if the column is text type.

at line 930
public boolean isNumericType()

Utility method to see if the column is numeric type.

Return Value

boolean

at line 939
public boolean isBooleanType()

Utility method to see if the column is boolean type.

Return Value

boolean

at line 948
public boolean isTemporalType()

Utility method to know whether column is a temporal column.

Return Value

boolean

at line 957
public boolean isPhpArrayType()

Utility method to know whether column is an array column.

Return Value

boolean

at line 966
public boolean isEnumType()

Utility method to know whether column is an ENUM column.

Return Value

boolean

at line 975
public setValueSet(array $valueSet)

Sets the list of possible values for an ENUM column

Parameters

array $valueSet

at line 984
public array getValueSet()

Returns the list of possible values for an ENUM column

Return Value

array

at line 1069
public string getSize()

Returns the size of the column

Return Value

string

at line 1078
public setSize(string $newSize)

Set the size of the column

Parameters

string $newSize

at line 1087
public string getScale()

Returns the scale of the column

Return Value

string

at line 1096
public setScale(string $newScale)

Set the scale of the column

Parameters

string $newScale

at line 1105
public printSize()

Return the size in brackets for use in an sql schema if the type is String.

Otherwise return an empty string

at line 1115
public string getDefaultSetting()

Return a string that will give this column a default value in SQL

Return Value

string

at line 1124
public string getDefaultValueString()

Return a string that will give this column a default value in PHP

Return Value

string

at line 1151
public Column setDefaultValue(ColumnDefaultValue|int|float|bool|string $def)

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

Parameters

ColumnDefaultValue|int|float|bool|string $def column default value

Return Value

Column

at line 1166
public ColumnDefaultValue getDefaultValue()

Get the default value object for this column.

Return Value

ColumnDefaultValue

at line 1176
public mixed getPhpDefaultValue()

Get the default value suitable for use in PHP.

Return Value

mixed

at line 1185
public isAutoIncrement()

Return auto increment/sequence string for the target database.

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

at line 1194
public isLazyLoad()

Return true if the columns has to be lazy loaded, i.e.

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

at line 1204
public string getAutoIncrementString()

Gets the auto-increment string.

Return Value

string

Exceptions

EngineException

at line 1223
public setAutoIncrement($value)

Set the auto increment value.

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

Parameters

$value

at line 1234
public setTypeFromString($typeName, $size)

Set the column type from a string property (normally a string from an sql input file)

Parameters

$typeName
$size

at line 1266
public string getPhpNative()

Return a string representation of the native PHP type which corresponds to the propel type of this column.

Use in the generation of Base objects.

Return Value

string PHP datatype used by propel.

at line 1276
public boolean isPhpPrimitiveType()

Returns true if the column's PHP native type is an boolean, int, long, float, double, string.

Return Value

boolean

at line 1286
public boolean isPhpPrimitiveNumericType()

Return true if column's PHP native type is an boolean, int, long, float, double.

Return Value

boolean

at line 1296
public boolean isPhpObjectType()

Returns true if the column's PHP native type is a class name.

Return Value

boolean

at line 1306
public Platform getPlatform()

Get the platform/adapter impl.

Return Value

Platform

at line 1311
public hasPlatform()

at line 1316
public getValidator()

at line 1325
public __clone()

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

Parameters

$name
$phpNamingMethod
$namePrefix