Propel 2 API
Class

Propel\Generator\Builder\Om\AbstractOMBuilder

abstract class AbstractOMBuilder extends DataModelBuilder

Baseclass for OM-building classes.

OM-building classes are those that build a PHP (or other) class to service
a single table. This includes Entity classes, Map classes,
Node classes, Nested Set classes, etc.

Methods

__construct(Table $table)

Creates new instance of DataModelBuilder subclass.

from DataModelBuilder
PluralizerInterface getPluralizer()

Returns new or existing Pluralizer class.

from DataModelBuilder
ObjectBuilder getObjectBuilder()

Returns new or existing Object builder class for this table.

from DataModelBuilder
ObjectBuilder getStubObjectBuilder()

Returns new or existing stub Object builder class for this table.

from DataModelBuilder
ObjectBuilder getQueryBuilder()

Returns new or existing Query builder class for this table.

from DataModelBuilder
ObjectBuilder getStubQueryBuilder()

Returns new or existing stub Query builder class for this table.

from DataModelBuilder
ObjectBuilder getTableMapBuilder()

Returns new or existing Object builder class for this table.

from DataModelBuilder
ObjectBuilder getInterfaceBuilder()

Returns new or existing stub Interface builder class for this table.

from DataModelBuilder
ObjectBuilder getMultiExtendObjectBuilder()

Returns new or existing stub child object builder class for this table.

from DataModelBuilder
DataSQLBuilder getDataSQLBuilder()

Returns new or existing data sql builder class for this table.

from DataModelBuilder
DataModelBuilder getNewBuilder(Table $table, string $classname)

Gets a new data model builder class for specified table and classname.

from DataModelBuilder
ObjectBuilder getNewObjectBuilder(Table $table)

Convenience method to return a NEW Object class builder instance.

from DataModelBuilder
ObjectBuilder getNewStubObjectBuilder(Table $table)

Convenience method to return a NEW Object stub class builder instance.

from DataModelBuilder
QueryBuilder getNewQueryBuilder(Table $table)

Convenience method to return a NEW query class builder instance.

from DataModelBuilder
QueryBuilder getNewStubQueryBuilder(Table $table)

Convenience method to return a NEW query stub class builder instance.

from DataModelBuilder
ObjectBuilder getNewQueryInheritanceBuilder($child)

Returns new Query Inheritance builder class for this table.

from DataModelBuilder
ObjectBuilder getNewStubQueryInheritanceBuilder($child)

Returns new stub Query Inheritance builder class for this table.

from DataModelBuilder
TableMapBuilder getNewTableMapBuilder(Table $table)

Returns new stub Query Inheritance builder class for this table.

from DataModelBuilder
GeneratorConfigInterface getGeneratorConfig()

Gets the GeneratorConfig object.

from DataModelBuilder
string getBuildProperty(string $name)

Get a specific [name transformed] build property.

from DataModelBuilder
setGeneratorConfig(GeneratorConfigInterface $v)

Sets the GeneratorConfig object.

from DataModelBuilder
setTable(Table $table)

Sets the table for this builder.

from DataModelBuilder
Table getTable()

Returns the current Table object.

from DataModelBuilder
PlatformInterface getPlatform()

Convenience method to returns the Platform class for this table (database).

from DataModelBuilder
setPlatform(PlatformInterface $platform)

Platform setter

from DataModelBuilder
Database getDatabase()

Convenience method to returns the database for current table.

from DataModelBuilder
string[] getWarnings()

Gets array of warning messages.

from DataModelBuilder
string quoteIdentifier(string $text)

Wraps call to Platform->quoteIdentifier() with a check to see whether quoting is enabled.

from DataModelBuilder
string prefixClassName($identifier)

Returns the name of the current class being built, with a possible prefix.

from DataModelBuilder
string build()

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

string buildObjectInstanceCreationCode($objName, $clsName)

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

string getUnprefixedClassName()

Returns the qualified (prefixed) classname that is being built by the current class.

string getUnqualifiedClassName()

Returns the unqualified classname (e.g.

string getQualifiedClassName()

Returns the qualified classname (e.g.

string getFullyQualifiedClassName()

Returns the fully qualified classname (e.g.

string getClassName()

Returns FQCN alias of getFullyQualifiedClassName

string getClasspath()

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

string getClassFilePath()

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

string getPackage()

Gets package name for this table.

string getPackagePath()

Returns filesystem path for current package.

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)

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

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

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

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

declareClasses()

array getDeclaredClasses(string $namespace = null)

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

string getNamespaceStatement()

return the string for the class namespace

string getUseStatements(string $ignoredNamespace = null)

Return all the use statement of the class

string getQueryClassName(boolean $fqcn = false)

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

string getObjectClassName(boolean $fqcn = false)

Returns the object classname for current table.

string getTableMapClassName(boolean $fqcn = false)

Returns the tableMap classname for current table.

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

Get the column constant name (e.g.

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).

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.

boolean hasBehaviorModifier(string $hookName, string $modifier)

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

getBehaviorContentBase(string $contentName, string $modifier)

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

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.

string getTableMapClass()

Details

in DataModelBuilder at line 122
public __construct(Table $table)

Creates new instance of DataModelBuilder subclass.

Parameters

Table $table The Table which we are using to build [OM, DDL, etc.].

in DataModelBuilder at line 131
public PluralizerInterface getPluralizer()

Returns new or existing Pluralizer class.

Return Value

PluralizerInterface

in DataModelBuilder at line 144
public ObjectBuilder getObjectBuilder()

Returns new or existing Object builder class for this table.

Return Value

ObjectBuilder

in DataModelBuilder at line 157
public ObjectBuilder getStubObjectBuilder()

Returns new or existing stub Object builder class for this table.

Return Value

ObjectBuilder

in DataModelBuilder at line 170
public ObjectBuilder getQueryBuilder()

Returns new or existing Query builder class for this table.

Return Value

ObjectBuilder

in DataModelBuilder at line 183
public ObjectBuilder getStubQueryBuilder()

Returns new or existing stub Query builder class for this table.

Return Value

ObjectBuilder

in DataModelBuilder at line 196
public ObjectBuilder getTableMapBuilder()

Returns new or existing Object builder class for this table.

Return Value

ObjectBuilder

in DataModelBuilder at line 209
public ObjectBuilder getInterfaceBuilder()

Returns new or existing stub Interface builder class for this table.

Return Value

ObjectBuilder

in DataModelBuilder at line 222
public ObjectBuilder getMultiExtendObjectBuilder()

Returns new or existing stub child object builder class for this table.

Return Value

ObjectBuilder

in DataModelBuilder at line 235
public DataSQLBuilder getDataSQLBuilder()

Returns new or existing data sql builder class for this table.

Return Value

DataSQLBuilder

in DataModelBuilder at line 251
public DataModelBuilder getNewBuilder(Table $table, string $classname)

Gets a new data model builder class for specified table and classname.

Parameters

Table $table
string $classname The class of builder

Return Value

DataModelBuilder

in DataModelBuilder at line 268
public ObjectBuilder getNewObjectBuilder(Table $table)

Convenience method to return a NEW Object class builder instance.

This is used very frequently from the tableMap and object builders to get
an object builder for a RELATED table.

Parameters

Table $table

Return Value

ObjectBuilder

in DataModelBuilder at line 282
public ObjectBuilder getNewStubObjectBuilder(Table $table)

Convenience method to return a NEW Object stub class builder instance.

This is used from the query builders to get
an object builder for a RELATED table.

Parameters

Table $table

Return Value

ObjectBuilder

in DataModelBuilder at line 296
public QueryBuilder getNewQueryBuilder(Table $table)

Convenience method to return a NEW query class builder instance.

This is used from the query builders to get
a query builder for a RELATED table.

Parameters

Table $table

Return Value

QueryBuilder

in DataModelBuilder at line 310
public QueryBuilder getNewStubQueryBuilder(Table $table)

Convenience method to return a NEW query stub class builder instance.

This is used from the query builders to get
a query builder for a RELATED table.

Parameters

Table $table

Return Value

QueryBuilder

in DataModelBuilder at line 319
public ObjectBuilder getNewQueryInheritanceBuilder($child)

Returns new Query Inheritance builder class for this table.

Parameters

$child

Return Value

ObjectBuilder

in DataModelBuilder at line 331
public ObjectBuilder getNewStubQueryInheritanceBuilder($child)

Returns new stub Query Inheritance builder class for this table.

Parameters

$child

Return Value

ObjectBuilder

in DataModelBuilder at line 343
public TableMapBuilder getNewTableMapBuilder(Table $table)

Returns new stub Query Inheritance builder class for this table.

Parameters

Table $table

Return Value

TableMapBuilder

in DataModelBuilder at line 353
public GeneratorConfigInterface getGeneratorConfig()

Gets the GeneratorConfig object.

in DataModelBuilder at line 364
public string getBuildProperty(string $name)

Get a specific [name transformed] build property.

Parameters

string $name

Return Value

string

in DataModelBuilder at line 378
public setGeneratorConfig(GeneratorConfigInterface $v)

Sets the GeneratorConfig object.

Parameters

GeneratorConfigInterface $v

in DataModelBuilder at line 387
public setTable(Table $table)

Sets the table for this builder.

Parameters

Table $table

in DataModelBuilder at line 396
public Table getTable()

Returns the current Table object.

Return Value

Table

in DataModelBuilder at line 405
public PlatformInterface getPlatform()

Convenience method to returns the Platform class for this table (database).

Return Value

PlatformInterface

in DataModelBuilder at line 423
public setPlatform(PlatformInterface $platform)

Platform setter

Parameters

PlatformInterface $platform

in DataModelBuilder at line 432
public Database getDatabase()

Convenience method to returns the database for current table.

Return Value

Database

in DataModelBuilder at line 452
public string[] getWarnings()

Gets array of warning messages.

Return Value

string[]

in DataModelBuilder at line 467
public string quoteIdentifier(string $text)

Wraps call to Platform->quoteIdentifier() with a check to see whether quoting is enabled.

All subclasses should call this quoteIdentifier() method rather than calling the Platform
method directly. This method is used by both DataSQLBuilder and DDLBuilder, and potentially
in the OM builders also, which is why it is defined in this class.

Parameters

string $text The text to quote.

Return Value

string Quoted text.

in DataModelBuilder at line 481
public string prefixClassName($identifier)

Returns the name of the current class being built, with a possible prefix.

Parameters

$identifier

Return Value

string

See also

OMBuilder#getClassName()

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.

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 122
abstract public string getUnprefixedClassName()

Returns the qualified (prefixed) classname that is being built by the current class.

This method must be implemented by child classes.

Return Value

string

at line 129
public string getUnqualifiedClassName()

Returns the unqualified classname (e.g.

Book)

Return Value

string

at line 139
public string getQualifiedClassName()

Returns the qualified classname (e.g.

Model\Book)

Return Value

string

at line 153
public string getFullyQualifiedClassName()

Returns the fully qualified classname (e.g.

\Model\Book)

Return Value

string

at line 162
public string getClassName()

Returns FQCN alias of getFullyQualifiedClassName

Return Value

string

at line 172
public string getClasspath()

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

Return Value

string

at line 186
public string getClassFilePath()

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

Return Value

string

at line 196
public string getPackage()

Gets package name for this table.

This is overridden by child classes that have different packages.

Return Value

string

at line 210
public string getPackagePath()

Returns filesystem path for current package.

Return Value

string

at line 230
public string getNamespace()

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

Return Value

string

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

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

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

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

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

at line 399
public declareClasses()

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

at line 427
public string getNamespaceStatement()

return the string for the class namespace

Return Value

string

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

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')

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')

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')

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.

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

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 687
public boolean hasBehaviorModifier(string $hookName, string $modifier)

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

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

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

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

at line 774
public string getTableMapClass()

Return Value

string