class TableMap
TableMap is used to model a table in a database.
Constants
TYPE_PHPNAME |
phpname type e.g. 'AuthorId' |
TYPE_STUDLYPHPNAME |
studlyphpname type e.g. 'authorId' |
TYPE_COLNAME |
column (tableMap) name type e.g. 'book.AUTHOR_ID' |
TYPE_RAW_COLNAME |
column part of the column tableMap name e.g. 'AUTHOR_ID' |
TYPE_FIELDNAME |
column fieldname type e.g. 'author_id' |
TYPE_NUM |
num type simply the numerical array index, e.g. 4 |
Methods
__construct($name = null, $dbMap = null)
Construct a new TableMap. |
||
initialize()
Initialize the TableMap to build columns, relations, etc This method should be overridden by descendants |
||
setDatabaseMap(DatabaseMap $dbMap)
Set the DatabaseMap containing this TableMap. |
||
DatabaseMap |
getDatabaseMap()
Get the DatabaseMap containing this TableMap. |
|
setName(string $name)
Set the name of the Table. |
||
string |
getName()
Get the name of the Table. |
|
setPhpName(string $phpName)
Set the PHP name of the Table. |
||
string |
getPhpName()
Get the PHP name of the Table. |
|
setClassName(string $classname)
Set the ClassName of the Table. |
||
string |
getClassName()
Get the ClassName of the Propel Class belonging to this table. |
|
setPackage(string $package)
Set the Package of the Table |
||
string |
getPackage()
Get the Package of the table. |
|
setUseIdGenerator(boolean $bit)
Set whether or not to use Id generator for primary key. |
||
boolean |
isUseIdGenerator()
Whether to use Id generator for primary key. |
|
setSingleTableInheritance(boolean $bit)
Set whether or not to this table uses single table inheritance |
||
boolean |
isSingleTableInheritance()
Whether this table uses single table inheritance |
|
setPrimaryKeyMethodInfo(mixed $pkInfo)
Sets the name of the sequence used to generate a key |
||
mixed |
getPrimaryKeyMethodInfo()
Get the name of the sequence used to generate a primary key |
|
ColumnMap |
addColumn($name, $phpName, $type, $isNotNull = false, $size = null, $defaultValue = null, $pk = false, $fkTable = null, $fkColumn = null)
Add a column to the table. |
|
ColumnMap |
addConfiguredColumn(ColumnMap $cmap)
Add a pre-created column to this table. |
|
boolean |
hasColumn(mixed $name, boolean $normalize = true)
Does this table contain the specified column? |
|
ColumnMap |
getColumn(string $name, boolean $normalize = true)
Get a ColumnMap for the table. |
|
boolean |
hasColumnByPhpName(mixed $phpName)
Does this table contain the specified column? |
|
ColumnMap |
getColumnByPhpName(string $phpName)
Get a ColumnMap for the table. |
|
ColumnMap[] |
getColumns()
Get a ColumnMap[] of the columns in this table. |
|
ColumnMap |
addPrimaryKey($columnName, $phpName, $type, $isNotNull = false, $size = null, $defaultValue = null)
Add a primary key column to this Table. |
|
ColumnMap |
addForeignKey($columnName, $phpName, $type, $fkTable, $fkColumn, $isNotNull = false, $size, $defaultValue = null)
Add a foreign key column to the table. |
|
ColumnMap |
addForeignPrimaryKey($columnName, $phpName, $type, $fkTable, $fkColumn, $isNotNull = false, $size, $defaultValue = null)
Add a foreign primary key column to the table. |
|
boolean | isCrossRef() | |
setIsCrossRef(boolean $isCrossRef)
Set the isCrossRef |
||
ColumnMap[] |
getPrimaryKeys()
Returns array of ColumnMap objects that make up the primary key for this table |
|
ColumnMap[] |
getForeignKeys()
Returns array of ColumnMap objects that are foreign keys for this table |
|
buildRelations()
Build relations Relations are lazy loaded for performance reasons This method should be overridden by descendants |
||
RelationMap |
addRelation(string $name, string $tablePhpName, integer $type, array $columnMapping = array(), string $onDelete = null, string $onUpdate = null, string $pluralName = null)
Adds a RelationMap to the table |
|
boolean |
hasRelation(string $name)
Gets a RelationMap of the table by relation name This method will build the relations if they are not built yet |
|
RelationMap |
getRelation(string $name)
Gets a RelationMap of the table by relation name This method will build the relations if they are not built yet |
|
array |
getRelations()
Gets the RelationMap objects of the table This method will build the relations if they are not built yet |
|
array |
getBehaviors()
Gets the list of behaviors registered for this table |
|
boolean |
hasPrimaryStringColumn()
Does this table has a primaryString column? |
|
ColumnMap |
getPrimaryStringColumn()
Gets the ColumnMap for the primary string column. |
|
static mixed |
doInsert(Criteria $criteria, ConnectionInterface $con = null)
Method to perform inserts based on values and keys in a Criteria. |
|
static | getFieldnamesForClass($classname, $type = TableMap::TYPE_PHPNAME) | |
static | translateFieldnameForClass($classname, $fieldname, $fromType, $toType) |
Details
at line 174
public
__construct($name = null, $dbMap = null)
Construct a new TableMap.
at line 189
public
initialize()
Initialize the TableMap to build columns, relations, etc This method should be overridden by descendants
at line 198
public
setDatabaseMap(DatabaseMap $dbMap)
Set the DatabaseMap containing this TableMap.
at line 208
public DatabaseMap
getDatabaseMap()
Get the DatabaseMap containing this TableMap.
at line 218
public
setName(string $name)
Set the name of the Table.
at line 228
public string
getName()
Get the name of the Table.
at line 238
public
setPhpName(string $phpName)
Set the PHP name of the Table.
at line 248
public string
getPhpName()
Get the PHP name of the Table.
at line 259
public
setClassName(string $classname)
Set the ClassName of the Table.
Could be useful for calling
tableMap and Object methods dynamically.
at line 269
public string
getClassName()
Get the ClassName of the Propel Class belonging to this table.
at line 279
public
setPackage(string $package)
Set the Package of the Table
at line 289
public string
getPackage()
Get the Package of the table.
at line 299
public
setUseIdGenerator(boolean $bit)
Set whether or not to use Id generator for primary key.
at line 309
public boolean
isUseIdGenerator()
Whether to use Id generator for primary key.
at line 319
public
setSingleTableInheritance(boolean $bit)
Set whether or not to this table uses single table inheritance
at line 329
public boolean
isSingleTableInheritance()
Whether this table uses single table inheritance
at line 339
public
setPrimaryKeyMethodInfo(mixed $pkInfo)
Sets the name of the sequence used to generate a key
at line 349
public mixed
getPrimaryKeyMethodInfo()
Get the name of the sequence used to generate a primary key
at line 398
public ColumnMap
addColumn($name, $phpName, $type, $isNotNull = false, $size = null, $defaultValue = null, $pk = false, $fkTable = null, $fkColumn = null)
Add a column to the table.
at line 430
public ColumnMap
addConfiguredColumn(ColumnMap $cmap)
Add a pre-created column to this table.
It will replace any
existing column.
at line 444
public boolean
hasColumn(mixed $name, boolean $normalize = true)
Does this table contain the specified column?
at line 463
public ColumnMap
getColumn(string $name, boolean $normalize = true)
Get a ColumnMap for the table.
at line 481
public boolean
hasColumnByPhpName(mixed $phpName)
Does this table contain the specified column?
at line 493
public ColumnMap
getColumnByPhpName(string $phpName)
Get a ColumnMap for the table.
at line 507
public ColumnMap[]
getColumns()
Get a ColumnMap[] of the columns in this table.
at line 521
public ColumnMap
addPrimaryKey($columnName, $phpName, $type, $isNotNull = false, $size = null, $defaultValue = null)
Add a primary key column to this Table.
at line 538
public ColumnMap
addForeignKey($columnName, $phpName, $type, $fkTable, $fkColumn, $isNotNull = false, $size, $defaultValue = null)
Add a foreign key column to the table.
at line 555
public ColumnMap
addForeignPrimaryKey($columnName, $phpName, $type, $fkTable, $fkColumn, $isNotNull = false, $size, $defaultValue = null)
Add a foreign primary key column to the table.
at line 563
public boolean
isCrossRef()
at line 573
public
setIsCrossRef(boolean $isCrossRef)
Set the isCrossRef
at line 583
public ColumnMap[]
getPrimaryKeys()
Returns array of ColumnMap objects that make up the primary key for this table
at line 593
public ColumnMap[]
getForeignKeys()
Returns array of ColumnMap objects that are foreign keys for this table
at line 603
public
buildRelations()
Build relations Relations are lazy loaded for performance reasons This method should be overridden by descendants
at line 619
public RelationMap
addRelation(string $name, string $tablePhpName, integer $type, array $columnMapping = array(), string $onDelete = null, string $onUpdate = null, string $pluralName = null)
Adds a RelationMap to the table
at line 658
public boolean
hasRelation(string $name)
Gets a RelationMap of the table by relation name This method will build the relations if they are not built yet
at line 671
public RelationMap
getRelation(string $name)
Gets a RelationMap of the table by relation name This method will build the relations if they are not built yet
at line 686
public array
getRelations()
Gets the RelationMap objects of the table This method will build the relations if they are not built yet
at line 702
public array
getBehaviors()
Gets the list of behaviors registered for this table
at line 712
public boolean
hasPrimaryStringColumn()
Does this table has a primaryString column?
at line 722
public ColumnMap
getPrimaryStringColumn()
Gets the ColumnMap for the primary string column.
at line 756
static public mixed
doInsert(Criteria $criteria, ConnectionInterface $con = null)
Method to perform inserts based on values and keys in a Criteria.
<p>
If the primary key is auto incremented the data in Criteria
will be inserted and the auto increment value will be returned.
<p>
If the primary key is included in Criteria then that value will
be used to insert the row.
<p>
If no primary key is included in Criteria then we will try to
figure out the primary key from the database map and insert the
row with the next available id using util.db.IDBroker.
<p>
If no primary key is defined for the table the values will be
inserted as specified in Criteria and null will be returned.