Propel API
Class

OMBuilder

abstract class OMBuilder 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 Peer classes, Entity classes, Map classes,
Node classes, Nested Set classes, etc.

Methods

__construct(Table $table)

Creates new instance of DataModelBuilder subclass.

from DataModelBuilder
PeerBuilder getPeerBuilder()

Returns new or existing Peer builder class for this table.

from DataModelBuilder
Pluralizer getPluralizer()

Returns new or existing Pluralizer class.

from DataModelBuilder
PeerBuilder getStubPeerBuilder()

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

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
ObjectBuilder getNodeBuilder()

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

from DataModelBuilder
PeerBuilder getNodePeerBuilder()

Returns new or existing node Peer builder class for this table.

from DataModelBuilder
ObjectBuilder getStubNodeBuilder()

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

from DataModelBuilder
PeerBuilder getStubNodePeerBuilder()

Returns new or existing stub node Peer builder class for this table.

from DataModelBuilder
ObjectBuilder getNestedSetBuilder()

Returns new or existing nested set object builder class for this table.

from DataModelBuilder
PeerBuilder getNestedSetPeerBuilder()

Returns new or existing nested set Peer 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
PeerBuilder getNewPeerBuilder(Table $table)

Convenience method to return a NEW Peer class builder instance.

from DataModelBuilder
PeerBuilder getNewStubPeerBuilder(Table $table)

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

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
GeneratorConfig 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
PropelPlatformInterface getPlatform()

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

from DataModelBuilder
setPlatform(PropelPlatformInterface $platform)

Platform setter

from DataModelBuilder
Database getDatabase()

Convenience method to returns the database for current table.

from DataModelBuilder
array 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 getClassname()

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

string getFullyQualifiedClassname()

Returns the namespaced classname if there is a namespace, and the raw classname otherwise

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

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

declareClassNamespace($class, $namespace = '')

declareClass($fullyQualifiedClassName)

declareClassFromBuilder($builder)

declareClasses()

getDeclaredClasses($namespace = null)

getNamespaceStatement()

getUseStatements($ignoredNamespace = null)

string getPeerClassname()

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

string getQueryClassname()

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

string getObjectClassname()

Returns the object classname for current table.

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

Get the column constant name (e.g.

string getBasePeer(Table $table)

Gets the basePeer path if specified for table/db.

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

Details

in DataModelBuilder at line 159
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 168
public PeerBuilder getPeerBuilder()

Returns new or existing Peer builder class for this table.

Return Value

PeerBuilder

in DataModelBuilder at line 181
public Pluralizer getPluralizer()

Returns new or existing Pluralizer class.

Return Value

Pluralizer

in DataModelBuilder at line 194
public PeerBuilder getStubPeerBuilder()

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

Return Value

PeerBuilder

in DataModelBuilder at line 207
public ObjectBuilder getObjectBuilder()

Returns new or existing Object builder class for this table.

Return Value

ObjectBuilder

in DataModelBuilder at line 220
public ObjectBuilder getStubObjectBuilder()

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

Return Value

ObjectBuilder

in DataModelBuilder at line 233
public ObjectBuilder getQueryBuilder()

Returns new or existing Query builder class for this table.

Return Value

ObjectBuilder

in DataModelBuilder at line 246
public ObjectBuilder getStubQueryBuilder()

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

Return Value

ObjectBuilder

in DataModelBuilder at line 259
public ObjectBuilder getTableMapBuilder()

Returns new or existing Object builder class for this table.

Return Value

ObjectBuilder

in DataModelBuilder at line 272
public ObjectBuilder getInterfaceBuilder()

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

Return Value

ObjectBuilder

in DataModelBuilder at line 285
public ObjectBuilder getMultiExtendObjectBuilder()

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

Return Value

ObjectBuilder

in DataModelBuilder at line 298
public ObjectBuilder getNodeBuilder()

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

Return Value

ObjectBuilder

in DataModelBuilder at line 311
public PeerBuilder getNodePeerBuilder()

Returns new or existing node Peer builder class for this table.

Return Value

PeerBuilder

in DataModelBuilder at line 324
public ObjectBuilder getStubNodeBuilder()

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

Return Value

ObjectBuilder

in DataModelBuilder at line 337
public PeerBuilder getStubNodePeerBuilder()

Returns new or existing stub node Peer builder class for this table.

Return Value

PeerBuilder

in DataModelBuilder at line 350
public ObjectBuilder getNestedSetBuilder()

Returns new or existing nested set object builder class for this table.

Return Value

ObjectBuilder

in DataModelBuilder at line 363
public PeerBuilder getNestedSetPeerBuilder()

Returns new or existing nested set Peer builder class for this table.

Return Value

PeerBuilder

in DataModelBuilder at line 376
public DataSQLBuilder getDataSQLBuilder()

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

Return Value

DataSQLBuilder

in DataModelBuilder at line 392
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 409
public PeerBuilder getNewPeerBuilder(Table $table)

Convenience method to return a NEW Peer class builder instance.

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

Parameters

Table $table

Return Value

PeerBuilder

in DataModelBuilder at line 423
public PeerBuilder getNewStubPeerBuilder(Table $table)

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

This is used from the peer and object builders to get
a peer builder for a RELATED table.

Parameters

Table $table

Return Value

PeerBuilder

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

Convenience method to return a NEW Object class builder instance.

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

Parameters

Table $table

Return Value

ObjectBuilder

in DataModelBuilder at line 451
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 465
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 479
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 488
public ObjectBuilder getNewQueryInheritanceBuilder($child)

Returns new Query Inheritance builder class for this table.

Parameters

$child

Return Value

ObjectBuilder

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

Returns new stub Query Inheritance builder class for this table.

Parameters

$child

Return Value

ObjectBuilder

in DataModelBuilder at line 513
public GeneratorConfig getGeneratorConfig()

Gets the GeneratorConfig object.

Return Value

GeneratorConfig

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

Get a specific [name transformed] build property.

Parameters

string $name

Return Value

string

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

Sets the GeneratorConfig object.

Parameters

GeneratorConfigInterface $v

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

Sets the table for this builder.

Parameters

Table $table

in DataModelBuilder at line 556
public Table getTable()

Returns the current Table object.

Return Value

Table

in DataModelBuilder at line 565
public PropelPlatformInterface getPlatform()

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

in DataModelBuilder at line 582
public setPlatform(PropelPlatformInterface $platform)

Platform setter

Parameters

PropelPlatformInterface $platform

in DataModelBuilder at line 591
public Database getDatabase()

Convenience method to returns the database for current table.

Return Value

Database

in DataModelBuilder at line 611
public array getWarnings()

Gets array of warning messages.

Return Value

array string[]

in DataModelBuilder at line 626
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 640
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 42
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 86
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 96
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 103
public string getClassname()

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

Return Value

string

See also

DataModelBuilder#prefixClassname()

at line 112
public string getFullyQualifiedClassname()

Returns the namespaced classname if there is a namespace, and the raw classname otherwise

Return Value

string

at line 125
public string getClasspath()

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

Return Value

string

at line 140
public string getClassFilePath()

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

Return Value

string

at line 150
public string getPackage()

Gets package name for this table.

This is overridden by child classes that have different packages.

Return Value

string

at line 164
public string getPackagePath()

Returns filesystem path for current package.

Return Value

string

at line 185
public string getNamespace()

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

Return Value

string

at line 190
public declareClassNamespace($class, $namespace = '')

Parameters

$class
$namespace

at line 199
public declareClass($fullyQualifiedClassName)

Parameters

$fullyQualifiedClassName

at line 210
public declareClassFromBuilder($builder)

Parameters

$builder

at line 215
public declareClasses()

at line 223
public getDeclaredClasses($namespace = null)

Parameters

$namespace

at line 232
public getNamespaceStatement()

at line 242
public getUseStatements($ignoredNamespace = null)

Parameters

$ignoredNamespace

at line 266
public string getPeerClassname()

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

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

Return Value

string (e.g. 'MyPeer')

See also

StubPeerBuilder::getClassname()

at line 278
public string getQueryClassname()

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

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

Return Value

string (e.g. 'Myquery')

See also

StubQueryBuilder::getClassname()

at line 290
public string getObjectClassname()

Returns the object classname for current table.

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

Return Value

string (e.g. 'My')

See also

StubPeerBuilder::getClassname()

at line 305
public string getColumnConstant(Column $col, string $classname = null)

Get the column constant name (e.g.

PeerName::COLUMN_NAME).

Parameters

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

Return Value

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

Exceptions

Exception

at line 330
public string getBasePeer(Table $table)

Gets the basePeer path if specified for table/db.

If not, will return 'propel.util.BasePeer'

Parameters

Table $table

Return Value

string

at line 380
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 443
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 506
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 524
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 552
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