class Table extends ScopedElement implements IDMethod
Data about a table used in an application.
Constants
DEBUG |
Enables some debug printing. |
Methods
value |
getNamespace()
Get the value of the namespace. |
from ScopedElement |
setNamespace(v $v)
Set the value of the namespace. |
from ScopedElement | |
value |
getPackage()
Get the value of package. |
from ScopedElement |
setPackage(v $v)
Set the value of package. |
from ScopedElement | |
value |
getSchema()
Get the value of schema. |
from ScopedElement |
setSchema(v $v)
Set the value of schema. |
from ScopedElement | |
__construct(string $name = null)
Constructs a table object with a name |
||
setupObject()
Sets up the Rule object based on the attributes that were passed to loadFromXML(). |
||
string |
getBuildProperty(string $key)
get a build property for the database this table belongs to |
|
applyBehaviors()
Execute behavior table modifiers |
||
doFinalInitialization()
<p>A hook for the SAX XML parser to call when this table has been fully loaded from the XML, and all nested elements have been processed.</p> |
||
addExtraIndices()
Adds extra indices for reverse foreign keys This is required for MySQL databases, and is called from Database::doFinalInitialization() |
||
string |
getColumnList(array $columns, string $delim = ',')
Creates a delimiter-delimited string list of column names |
|
doNaming()
Names composing objects which haven't yet been named. |
||
The |
getBaseClass()
Gets the value of base class for classes produced from this table. |
|
setBaseClass(v $v)
Set the value of baseClass. |
||
value |
getBasePeer()
Get the value of basePeer. |
|
setBasePeer(v $v)
Set the value of basePeer. |
||
the |
addColumn($coldata $data)
A utility function to create a new column from attrib and add it to this table. |
|
removeColumn(Column|string $col)
Removed a column from the table |
||
adjustColumnPositions() | ||
Validator |
addValidator(mixed $data)
Add a validator to this table. |
|
removeValidatorForColumn(string $columnName)
Removes validators based on a column name |
||
addForeignKey($fkdata)
A utility function to create a new foreign key from attrib and add it to this table. |
||
Column |
getChildrenColumn()
Gets the column that subclasses of the class representing this table can be produced from. |
|
array |
getChildrenNames()
Get the subclasses that can be created from this table. |
|
addReferrer(ForeignKey $fk)
Adds the foreign key from another table that refers to this table. |
||
getReferrers()
Get list of references to this table. |
||
setupReferrers($throwErrors = false)
Browses the foreign keys and creates referrers for the foreign table. |
||
getCrossFks() | ||
setContainsForeignPK($b)
Set whether this table contains a foreign PK |
||
getContainsForeignPK()
Determine if this table contains a foreign PK |
||
getForeignTableNames()
A list of tables referenced by foreign keys in this table |
||
requiresTransactionInPostgres()
Return true if the column requires a transaction in Postgres |
||
addIdMethodParameter($impdata)
A utility function to create a new id method parameter from attrib or object and add it to this table. |
||
addIndex($idxdata)
Adds a new index to the index list and set the parent table of the column to the current table |
||
addUnique($unqdata)
Adds a new Unique to the Unique list and set the parent table of the column to the current table |
||
GeneratorConfig |
getGeneratorConfig()
Retrieves the configuration object, filled by build.properties |
|
Behavior |
addBehavior($bdata)
Adds a new Behavior to the table |
|
Array |
getBehaviors()
Get the table behaviors |
|
Array |
getEarlyBehaviors()
Get the early table behaviors |
|
boolean |
hasBehavior(string $name)
check if the table has a behavior by name |
|
Behavior |
getBehavior(string $name)
Get one table behavior by name |
|
boolean |
hasAdditionalBuilders()
Check whether one of the table behaviors offer an additional builder |
|
array |
getAdditionalBuilders()
Get the additional builders provided by the table behaviors |
|
getName()
Get the name of the Table |
||
getDescription()
Get the description for the Table |
||
hasDescription()
Whether the Table has a description |
||
setDescription(newDescription $newDescription)
Set the description for the Table |
||
string |
getPhpName()
Get name to use in PHP sources |
|
setPhpName(string $phpName)
Set name to use in PHP sources |
||
buildPhpName($name) | ||
string |
getStudlyPhpName()
Get studly version of PHP name. |
|
getCommonName()
Get the name without schema |
||
setCommonName($v)
Set the common name of the table (without schema) |
||
setDefaultStringFormat(string $defaultStringFormat)
Set the default string format for ActiveRecord objects in this Table. |
||
string |
getDefaultStringFormat()
Get the default string format for ActiveRecord objects in this Table, or the one for the whole database if not set. |
|
string |
getIdMethod()
Get the method for generating pk's [HL] changing behavior so that Database default method is returned if no method has been specified for the table. |
|
boolean |
isAllowPkInsert()
Whether we allow to insert primary keys on tables with idMethod=native |
|
setIdMethod($idMethod)
Set the method for generating pk's |
||
boolean |
isSkipSql()
Skip generating sql for this table (in the event it should not be created from scratch). |
|
boolan |
isReadOnly()
Is table read-only, in which case only accessors (and relationship setters) will be created. |
|
setSkipSql(boolean $v)
Set whether this table should have its creation sql generated. |
||
boolean |
isReloadOnInsert()
Whether to force object to reload on INSERT. |
|
boolean |
isReloadOnUpdate()
Whether to force object to reload on UPDATE. |
|
value |
getAlias()
PhpName of om object this entry references. |
|
value |
isAlias()
Is this table specified in the schema or is there just a foreign key reference to it. |
|
setAlias(v $v)
Set whether this table specified in the schema or is there just a foreign key reference to it. |
||
value |
getInterface()
Interface which objects for this table will implement |
|
setInterface(v $v)
Interface which objects for this table will implement |
||
value |
isAbstract()
When a table is abstract, it marks the business object class that is generated as being abstract. |
|
setAbstract(v $v)
When a table is abstract, it marks the business object class that is generated as being abstract. |
||
array |
getColumns()
Returns an Array containing all the columns in the table |
|
getNumColumns()
Utility method to get the number of columns in this table |
||
getNumLazyLoadColumns()
Utility method to get the number of columns in this table |
||
boolean |
hasEnumColumns()
Checks whether one of the columns is of type ENUM |
|
array |
getValidators()
Returns an Array containing all the validators in the table |
|
array |
getForeignKeys()
Returns an Array containing all the FKs in the table. |
|
getIdMethodParameters()
Returns a Collection of parameters relevant for the chosen id generation method. |
||
array |
getIndices()
Returns an Array containing all the FKs in the table |
|
array |
getUnices()
Returns an Array containing all the UKs in the table |
|
boolean |
hasColumn(Column|string $col, boolean $caseInsensitive = false)
Check whether the table has a column. |
|
Column |
getColumn(string $name, boolean $caseInsensitive = false)
Return the column with the specified name. |
|
Column |
getColumnByPhpName($phpName)
Returns a specified column. |
|
array |
getForeignKeysReferencingTable($tablename)
Get all the foreign keys from this table to the specified table. |
|
array |
getColumnForeignKeys($colname)
Return the foreign keys that includes col in it's list of local columns. |
|
boolean |
containsColumn(Column|string $col)
Check whether the table has a column. |
|
setDatabase(Database $db)
Set the database that contains this table. |
||
Database |
getDatabase()
Get the database that contains this table. |
|
boolean |
isForReferenceOnly()
Flag to determine if code/sql gets created for this table. |
|
setForReferenceOnly(boolean $v)
Flag to determine if code/sql gets created for this table. |
||
valur |
treeMode()
Flag to determine if tree node class should be generated for this table. |
|
setTreeMode(v $v)
Flag to determine if tree node class should be generated for this table. |
||
appendXml(DOMNode $node)
Appends XML nodes to passed-in DOMNode. |
||
array |
getPrimaryKey()
Returns the collection of Columns which make up the single primary key for this table. |
|
boolean |
hasPrimaryKey()
Determine whether this table has a primary key. |
|
boolean |
hasCompositePrimaryKey()
Determine whether this table has a composite primary key. |
|
getFirstPrimaryKeyColumn()
Get the first column of the primary key. |
||
boolean |
hasAutoIncrementPrimaryKey()
Determine whether this table has any auto-increment primary key(s). |
|
Column |
getAutoIncrementPrimaryKey()
Gets the auto increment PK |
|
A |
printPrimaryKey()
Returns all parts of the primary key, separated by commas. |
|
boolean |
getIsCrossRef()
Gets the crossRef status for this foreign key |
|
setIsCrossRef(boolean $isCrossRef)
Sets a crossref status for this foreign key. |
||
Boolean |
hasForeignKeys()
Returns whether the table has foreign keys or not. |
|
Boolean |
hasCrossForeignKeys()
Returns whether the table has cross foreign keys or not. |
Details
in ScopedElement at line 71
public value
getNamespace()
Get the value of the namespace.
in ScopedElement at line 80
public
setNamespace(v $v)
Set the value of the namespace.
in ScopedElement at line 96
public value
getPackage()
Get the value of package.
in ScopedElement at line 105
public
setPackage(v $v)
Set the value of package.
in ScopedElement at line 118
public value
getSchema()
Get the value of schema.
in ScopedElement at line 127
public
setSchema(v $v)
Set the value of schema.
at line 302
public
__construct(string $name = null)
Constructs a table object with a name
at line 325
public
setupObject()
Sets up the Rule object based on the attributes that were passed to loadFromXML().
at line 366
public string
getBuildProperty(string $key)
get a build property for the database this table belongs to
at line 374
public
applyBehaviors()
Execute behavior table modifiers
at line 392
public
doFinalInitialization()
<p>A hook for the SAX XML parser to call when this table has been fully loaded from the XML, and all nested elements have been processed.</p>
<p>Performs heavy indexing and naming of elements which weren't
provided with a name.</p>
at line 458
public
addExtraIndices()
Adds extra indices for reverse foreign keys This is required for MySQL databases, and is called from Database::doFinalInitialization()
at line 548
public string
getColumnList(array $columns, string $delim = ',')
Creates a delimiter-delimited string list of column names
at line 564
public
doNaming()
Names composing objects which haven't yet been named.
This
currently consists of foreign-key and index entities.
at line 628
public The
getBaseClass()
Gets the value of base class for classes produced from this table.
at line 643
public
setBaseClass(v $v)
Set the value of baseClass.
at line 652
public value
getBasePeer()
Get the value of basePeer.
at line 667
public
setBasePeer(v $v)
Set the value of basePeer.
at line 679
public the
addColumn($coldata $data)
A utility function to create a new column from attrib and add it to this table.
at line 712
public
removeColumn(Column|string $col)
Removed a column from the table
at line 729
public
adjustColumnPositions()
at line 749
public Validator
addValidator(mixed $data)
Add a validator to this table.
Supports two signatures:
- addValidator(Validator $validator)
- addValidator(array $attribs)
at line 775
public
removeValidatorForColumn(string $columnName)
Removes validators based on a column name
at line 788
public
addForeignKey($fkdata)
A utility function to create a new foreign key from attrib and add it to this table.
at line 815
public Column
getChildrenColumn()
Gets the column that subclasses of the class representing this table can be produced from.
at line 824
public array
getChildrenNames()
Get the subclasses that can be created from this table.
at line 841
public
addReferrer(ForeignKey $fk)
Adds the foreign key from another table that refers to this table.
at line 852
public
getReferrers()
Get list of references to this table.
at line 863
public
setupReferrers($throwErrors = false)
Browses the foreign keys and creates referrers for the foreign table.
This method can be called several times on the same table. It only
adds the missing referrers and is non-destructive.
Warning: only use when all the tables were created.
at line 932
public
getCrossFks()
at line 948
public
setContainsForeignPK($b)
Set whether this table contains a foreign PK
at line 956
public
getContainsForeignPK()
Determine if this table contains a foreign PK
at line 964
public
getForeignTableNames()
A list of tables referenced by foreign keys in this table
at line 975
public
requiresTransactionInPostgres()
Return true if the column requires a transaction in Postgres
at line 984
public
addIdMethodParameter($impdata)
A utility function to create a new id method parameter from attrib or object and add it to this table.
at line 1005
public
addIndex($idxdata)
Adds a new index to the index list and set the parent table of the column to the current table
at line 1024
public
addUnique($unqdata)
Adds a new Unique to the Unique list and set the parent table of the column to the current table
at line 1044
public GeneratorConfig
getGeneratorConfig()
Retrieves the configuration object, filled by build.properties
at line 1053
public Behavior
addBehavior($bdata)
Adds a new Behavior to the table
at line 1072
public Array
getBehaviors()
Get the table behaviors
at line 1081
public Array
getEarlyBehaviors()
Get the early table behaviors
at line 1098
public boolean
hasBehavior(string $name)
check if the table has a behavior by name
at line 1109
public Behavior
getBehavior(string $name)
Get one table behavior by name
at line 1120
public boolean
hasAdditionalBuilders()
Check whether one of the table behaviors offer an additional builder
at line 1136
public array
getAdditionalBuilders()
Get the additional builders provided by the table behaviors
at line 1149
public
getName()
Get the name of the Table
at line 1162
public
getDescription()
Get the description for the Table
at line 1170
public
hasDescription()
Whether the Table has a description
at line 1180
public
setDescription(newDescription $newDescription)
Set the description for the Table
at line 1189
public string
getPhpName()
Get name to use in PHP sources
at line 1209
public
setPhpName(string $phpName)
Set name to use in PHP sources
at line 1214
public
buildPhpName($name)
at line 1226
public string
getStudlyPhpName()
Get studly version of PHP name.
The studly name is the PHP name with the first character lowercase.
at line 1239
public
getCommonName()
Get the name without schema
at line 1247
public
setCommonName($v)
Set the common name of the table (without schema)
at line 1257
public
setDefaultStringFormat(string $defaultStringFormat)
Set the default string format for ActiveRecord objects in this Table.
at line 1268
public string
getDefaultStringFormat()
Get the default string format for ActiveRecord objects in this Table, or the one for the whole database if not set.
at line 1283
public string
getIdMethod()
Get the method for generating pk's [HL] changing behavior so that Database default method is returned if no method has been specified for the table.
at line 1298
public boolean
isAllowPkInsert()
Whether we allow to insert primary keys on tables with idMethod=native
at line 1307
public
setIdMethod($idMethod)
Set the method for generating pk's
at line 1317
public boolean
isSkipSql()
Skip generating sql for this table (in the event it should not be created from scratch).
at line 1327
public boolan
isReadOnly()
Is table read-only, in which case only accessors (and relationship setters) will be created.
at line 1336
public
setSkipSql(boolean $v)
Set whether this table should have its creation sql generated.
at line 1345
public boolean
isReloadOnInsert()
Whether to force object to reload on INSERT.
at line 1354
public boolean
isReloadOnUpdate()
Whether to force object to reload on UPDATE.
at line 1363
public value
getAlias()
PhpName of om object this entry references.
at line 1373
public value
isAlias()
Is this table specified in the schema or is there just a foreign key reference to it.
at line 1383
public
setAlias(v $v)
Set whether this table specified in the schema or is there just a foreign key reference to it.
at line 1393
public value
getInterface()
Interface which objects for this table will implement
at line 1402
public
setInterface(v $v)
Interface which objects for this table will implement
at line 1415
public value
isAbstract()
When a table is abstract, it marks the business object class that is generated as being abstract.
If you have a table called "FOO", then the
Foo BO will be <code>public abstract class Foo</code>
This helps support class hierarchies
at line 1429
public
setAbstract(v $v)
When a table is abstract, it marks the business object class that is generated as being abstract.
If you have a
table called "FOO", then the Foo BO will be
<code>public abstract class Foo</code>
This helps support class hierarchies
at line 1438
public array
getColumns()
Returns an Array containing all the columns in the table
at line 1446
public
getNumColumns()
Utility method to get the number of columns in this table
at line 1454
public
getNumLazyLoadColumns()
Utility method to get the number of columns in this table
at line 1469
public boolean
hasEnumColumns()
Checks whether one of the columns is of type ENUM
at line 1483
public array
getValidators()
Returns an Array containing all the validators in the table
at line 1492
public array
getForeignKeys()
Returns an Array containing all the FKs in the table.
at line 1501
public
getIdMethodParameters()
Returns a Collection of parameters relevant for the chosen id generation method.
at line 1510
public array
getIndices()
Returns an Array containing all the FKs in the table
at line 1519
public array
getUnices()
Returns an Array containing all the UKs in the table
at line 1531
public boolean
hasColumn(Column|string $col, boolean $caseInsensitive = false)
Check whether the table has a column.
at line 1550
public Column
getColumn(string $name, boolean $caseInsensitive = false)
Return the column with the specified name.
at line 1566
public Column
getColumnByPhpName($phpName)
Returns a specified column.
at line 1578
public array
getForeignKeysReferencingTable($tablename)
Get all the foreign keys from this table to the specified table.
at line 1596
public array
getColumnForeignKeys($colname)
Return the foreign keys that includes col in it's list of local columns.
Eg. Foreign key (a,b,c) refrences tbl(x,y,z) will be returned of col is either a,b or c.
at line 1613
public boolean
containsColumn(Column|string $col)
Check whether the table has a column.
at line 1623
public
setDatabase(Database $db)
Set the database that contains this table.
at line 1633
public Database
getDatabase()
Get the database that contains this table.
at line 1643
public boolean
isForReferenceOnly()
Flag to determine if code/sql gets created for this table.
Table will be skipped, if return true.
at line 1653
public
setForReferenceOnly(boolean $v)
Flag to determine if code/sql gets created for this table.
Table will be skipped, if set to true.
at line 1662
public valur
treeMode()
Flag to determine if tree node class should be generated for this table.
at line 1671
public
setTreeMode(v $v)
Flag to determine if tree node class should be generated for this table.
at line 1681
public
appendXml(DOMNode $node)
Appends XML nodes to passed-in DOMNode.
at line 1793
public array
getPrimaryKey()
Returns the collection of Columns which make up the single primary key for this table.
at line 1809
public boolean
hasPrimaryKey()
Determine whether this table has a primary key.
at line 1819
public boolean
hasCompositePrimaryKey()
Determine whether this table has a composite primary key.
at line 1828
public
getFirstPrimaryKeyColumn()
Get the first column of the primary key.
Useful for tables with a PK using a single column.
at line 1842
public boolean
hasAutoIncrementPrimaryKey()
Determine whether this table has any auto-increment primary key(s).
at line 1860
public Column
getAutoIncrementPrimaryKey()
Gets the auto increment PK
at line 1879
public A
printPrimaryKey()
Returns all parts of the primary key, separated by commas.
at line 1888
public boolean
getIsCrossRef()
Gets the crossRef status for this foreign key
at line 1897
public
setIsCrossRef(boolean $isCrossRef)
Sets a crossref status for this foreign key.
at line 1924
public Boolean
hasForeignKeys()
Returns whether the table has foreign keys or not.
at line 1933
public Boolean
hasCrossForeignKeys()
Returns whether the table has cross foreign keys or not.