Propel 2 API
Class

Propel\Generator\Builder\Om\TableMapBuilder

class TableMapBuilder extends AbstractOMBuilder

Generates the PHP5 table map class for user object model (OM).

Methods

string build()

Builds the PHP source for current class and returns it as a string.

from AbstractOMBuilder
string buildObjectInstanceCreationCode($objName, $clsName)

Creates a $obj = new Book(); code snippet.

from AbstractOMBuilder
string getUnprefixedClassName()

Returns the name of the current class being built.

string getUnqualifiedClassName()

Returns the unqualified classname (e.g.

from AbstractOMBuilder
string getQualifiedClassName()

Returns the qualified classname (e.g.

from AbstractOMBuilder
string getFullyQualifiedClassName()

Returns the fully qualified classname (e.g.

from AbstractOMBuilder
string getClassName()

Returns FQCN alias of getFullyQualifiedClassName

from AbstractOMBuilder
string getClasspath()

Gets the dot-path representation of current class being built.

from AbstractOMBuilder
string getClassFilePath()

Gets the full path to the file for the current class.

from AbstractOMBuilder
string getPackage()

Gets the package for the map builder classes.

string getPackagePath()

Returns filesystem path for current package.

from AbstractOMBuilder
string getNamespace()

Returns the user-defined namespace for this table, or the database namespace otherwise.

string getClassNameFromBuilder(AbstractOMBuilder $builder, boolean $fqcn = false)

This declare the class use and get the correct name to use (short classname, Alias, or FQCN)

from AbstractOMBuilder
string declareClassNamespace(string $class, string $namespace = '', string|boolean $alias = false)

Declare a class to be use and return it's name or it's alias

from AbstractOMBuilder
string declareClassNamespacePrefix(string $class, string $namespace = '', mixed $aliasPrefix = false)

Declare a use statement for a $class with a $namespace and an $aliasPrefix This return the short ClassName or an alias

from AbstractOMBuilder
string declareClass(string $fullyQualifiedClassName, mixed $aliasPrefix = false)

Declare a Fully qualified classname with an $aliasPrefix This return the short ClassName to use or an alias

from AbstractOMBuilder
declareClassFromBuilder($builder $builder, boolean|string $aliasPrefix = false)

from AbstractOMBuilder
declareClasses()

from AbstractOMBuilder
array getDeclaredClasses(string $namespace = null)

Get the list of declared classes for a given $namespace or all declared classes

from AbstractOMBuilder
string getNamespaceStatement()

return the string for the class namespace

from AbstractOMBuilder
string getUseStatements(string $ignoredNamespace = null)

Return all the use statement of the class

from AbstractOMBuilder
string getQueryClassName(boolean $fqcn = false)

Shortcut method to return the [stub] query classname for current table.

from AbstractOMBuilder
string getObjectClassName(boolean $fqcn = false)

Returns the object classname for current table.

from AbstractOMBuilder
string getTableMapClassName(boolean $fqcn = false)

Returns the tableMap classname for current table.

from AbstractOMBuilder
string getColumnConstant(Column $col, string $classname = null)

Get the column constant name (e.g.

from AbstractOMBuilder
string getFKPhpNameAffix(ForeignKey $fk, boolean $plural = false)

Gets the PHP method name affix to be used for fkeys for the current table (not referrers to this table).

from AbstractOMBuilder
string getRefFKPhpNameAffix(ForeignKey $fk, boolean $plural = false)

Gets the PHP method name affix to be used for referencing foreign key methods and variable names (e.g.

from AbstractOMBuilder
boolean hasBehaviorModifier(string $hookName, string $modifier = null)

Checks whether any registered behavior on that table has a modifier for a hook

applyBehaviorModifierBase($hookName, $modifier, $script, $tab = ' ')

Checks whether any registered behavior on that table has a modifier for a hook

from AbstractOMBuilder
getBehaviorContentBase(string $contentName, string $modifier)

Checks whether any registered behavior content creator on that table exists a contentName

from AbstractOMBuilder
string renderTemplate(string $filename, array $vars = array(), string $templateDir = '/templates/')

Use Propel simple templating system to render a PHP file using variables passed as arguments.

from AbstractOMBuilder
string getTableMapClass()

from AbstractOMBuilder
getBaseTableMapClassName()

addInheritanceColumnConstants(string $script)

Adds the CLASSKEY_* and CLASSNAME_* constants used for inheritance.

string getInstancePoolKeySnippet(array $pkphp)

Adds the PHP code to return a instance pool key for the passed-in primary key variable names.

addInstancePool()

addClearRelatedInstancePool()

applyBehaviorModifier($hookName, $script, $tab = ' ')

Checks whether any registered behavior on that table has a modifier for a hook

Details

in AbstractOMBuilder at line 65
public string build()

Builds the PHP source for current class and returns it as a string.

This is the main entry point and defines a basic structure that classes should follow.
In most cases this method will not need to be overridden by subclasses. This method
does assume that the output language is PHP code, so it will need to be overridden if
this is not the case.

Return Value

string The resulting PHP sourcecode.

in AbstractOMBuilder at line 111
public string buildObjectInstanceCreationCode($objName, $clsName)

Creates a $obj = new Book(); code snippet.

Can be used by frameworks, for instance, to
extend this behavior, e.g. initialize the object after creating the instance or so.

Parameters

$objName
$clsName

Return Value

string Some code

at line 57
public string getUnprefixedClassName()

Returns the name of the current class being built.

Return Value

string

in AbstractOMBuilder at line 129
public string getUnqualifiedClassName()

Returns the unqualified classname (e.g.

Book)

Return Value

string

in AbstractOMBuilder at line 139
public string getQualifiedClassName()

Returns the qualified classname (e.g.

Model\Book)

Return Value

string

in AbstractOMBuilder at line 153
public string getFullyQualifiedClassName()

Returns the fully qualified classname (e.g.

\Model\Book)

Return Value

string

in AbstractOMBuilder at line 162
public string getClassName()

Returns FQCN alias of getFullyQualifiedClassName

Return Value

string

in AbstractOMBuilder at line 172
public string getClasspath()

Gets the dot-path representation of current class being built.

Return Value

string

in AbstractOMBuilder at line 186
public string getClassFilePath()

Gets the full path to the file for the current class.

Return Value

string

at line 29
public string getPackage()

Gets the package for the map builder classes.

Return Value

string

in AbstractOMBuilder at line 210
public string getPackagePath()

Returns filesystem path for current package.

Return Value

string

at line 34
public string getNamespace()

Returns the user-defined namespace for this table, or the database namespace otherwise.

Return Value

string

in AbstractOMBuilder at line 242
public string getClassNameFromBuilder(AbstractOMBuilder $builder, boolean $fqcn = false)

This declare the class use and get the correct name to use (short classname, Alias, or FQCN)

Parameters

AbstractOMBuilder $builder
boolean $fqcn true to return the $fqcn classname

Return Value

string ClassName, Alias or FQCN

in AbstractOMBuilder at line 267
public string declareClassNamespace(string $class, string $namespace = '', string|boolean $alias = false)

Declare a class to be use and return it's name or it's alias

Parameters

string $class the class name
string $namespace the namespace
string|boolean $alias the alias wanted, if set to True, it automatically adds an alias when needed

Return Value

string the class name or it's alias

in AbstractOMBuilder at line 361
public string declareClassNamespacePrefix(string $class, string $namespace = '', mixed $aliasPrefix = false)

Declare a use statement for a $class with a $namespace and an $aliasPrefix This return the short ClassName or an alias

Parameters

string $class the class
string $namespace the namespace
mixed $aliasPrefix optionally an alias or True to force an automatic alias prefix (Base or Child)

Return Value

string the short ClassName or an alias

in AbstractOMBuilder at line 380
public string declareClass(string $fullyQualifiedClassName, mixed $aliasPrefix = false)

Declare a Fully qualified classname with an $aliasPrefix This return the short ClassName to use or an alias

Parameters

string $fullyQualifiedClassName the fully qualified classname
mixed $aliasPrefix optionally an alias or True to force an automatic alias prefix (Base or Child)

Return Value

string the short ClassName or an alias

in AbstractOMBuilder at line 394
public declareClassFromBuilder($builder $builder, boolean|string $aliasPrefix = false)

Parameters

$builder $builder
boolean|string $aliasPrefix the prefix for the Alias or True for auto generation of the Alias

in AbstractOMBuilder at line 399
public declareClasses()

in AbstractOMBuilder at line 413
public array getDeclaredClasses(string $namespace = null)

Get the list of declared classes for a given $namespace or all declared classes

Parameters

string $namespace the namespace or null

Return Value

array list of declared classes

in AbstractOMBuilder at line 427
public string getNamespaceStatement()

return the string for the class namespace

Return Value

string

in AbstractOMBuilder at line 443
public string getUseStatements(string $ignoredNamespace = null)

Return all the use statement of the class

Parameters

string $ignoredNamespace the ignored namespace

Return Value

string

in AbstractOMBuilder at line 476
public string getQueryClassName(boolean $fqcn = false)

Shortcut method to return the [stub] query classname for current table.

This is the classname that is used whenever object or tablemap classes want
to invoke methods of the query classes.

Parameters

boolean $fqcn

Return Value

string (e.g. 'Myquery')

in AbstractOMBuilder at line 488
public string getObjectClassName(boolean $fqcn = false)

Returns the object classname for current table.

This is the classname that is used whenever object or tablemap classes want
to invoke methods of the object classes.

Parameters

boolean $fqcn

Return Value

string (e.g. 'My')

in AbstractOMBuilder at line 500
public string getTableMapClassName(boolean $fqcn = false)

Returns the tableMap classname for current table.

This is the classname that is used whenever object or tablemap classes want
to invoke methods of the object classes.

Parameters

boolean $fqcn

Return Value

string (e.g. 'My')

in AbstractOMBuilder at line 513
public string getColumnConstant(Column $col, string $classname = null)

Get the column constant name (e.g.

TableMapName::COLUMN_NAME).

Parameters

Column $col The column we need a name for.
string $classname The TableMap classname to use.

Return Value

string If $classname is provided, then will return $classname::COLUMN_NAME; if not, then the TableMapName is looked up for current table to yield $currTableTableMap::COLUMN_NAME.

in AbstractOMBuilder at line 574
public string getFKPhpNameAffix(ForeignKey $fk, boolean $plural = false)

Gets the PHP method name affix to be used for fkeys for the current table (not referrers to this table).

The difference between this method and the getRefFKPhpNameAffix() method is that in this method the
classname in the affix is the foreign table classname.

Parameters

ForeignKey $fk The local FK that we need a name for.
boolean $plural Whether the php name should be plural (e.g. initRelatedObjs() vs. addRelatedObj()

Return Value

string

in AbstractOMBuilder at line 636
public string getRefFKPhpNameAffix(ForeignKey $fk, boolean $plural = false)

Gets the PHP method name affix to be used for referencing foreign key methods and variable names (e.g.

set????(), $coll???).

The difference between this method and the getFKPhpNameAffix() method is that in this method the
classname in the affix is the classname of the local fkey table.

Parameters

ForeignKey $fk The referrer FK that we need a name for.
boolean $plural Whether the php name should be plural (e.g. initRelatedObjs() vs. addRelatedObj()

Return Value

string

at line 732
public boolean hasBehaviorModifier(string $hookName, string $modifier = null)

Checks whether any registered behavior on that table has a modifier for a hook

Parameters

string $hookName The name of the hook as called from one of this class methods, e.g. "preSave"
string $modifier The name of the modifier object providing the method in the behavior

Return Value

boolean

in AbstractOMBuilder at line 705
public applyBehaviorModifierBase($hookName, $modifier, $script, $tab = ' ')

Checks whether any registered behavior on that table has a modifier for a hook

Parameters

$hookName
$modifier
$script
$tab

in AbstractOMBuilder at line 733
public getBehaviorContentBase(string $contentName, string $modifier)

Checks whether any registered behavior content creator on that table exists a contentName

Parameters

string $contentName The name of the content as called from one of this class methods, e.g. "parentClassName"
string $modifier The name of the modifier object providing the method in the behavior

in AbstractOMBuilder at line 754
public string renderTemplate(string $filename, array $vars = array(), string $templateDir = '/templates/')

Use Propel simple templating system to render a PHP file using variables passed as arguments.

The template file name is relative to the behavior's
directory name.

Parameters

string $filename
array $vars
string $templateDir

Return Value

string

in AbstractOMBuilder at line 774
public string getTableMapClass()

Return Value

string

at line 48
public getBaseTableMapClassName()

at line 302
public addInheritanceColumnConstants(string $script)

Adds the CLASSKEY_* and CLASSNAME_* constants used for inheritance.

Parameters

string $script &$script The script will be modified in this method.

at line 641
public string getInstancePoolKeySnippet(array $pkphp)

Adds the PHP code to return a instance pool key for the passed-in primary key variable names.

Parameters

array $pkphp An array of PHP var names / method calls representing complete pk.

Return Value

string

at line 659
public addInstancePool()

at line 692
public addClearRelatedInstancePool()

at line 742
public applyBehaviorModifier($hookName, $script, $tab = ' ')

Checks whether any registered behavior on that table has a modifier for a hook

Parameters

$hookName
$script
$tab