Propel 2 API
Class

Propel\Generator\Model\Behavior

class Behavior extends MappingModel

Information about behaviors of a table.

Methods

__construct()

from MappingModel
loadMapping(array $attributes)

Loads a mapping definition from an array.

from MappingModel
array getAttributes()

Returns all definition attributes.

from MappingModel
mixed getAttribute(string $name, mixed $default = null)

Returns a particular attribute by a case-insensitive name.

from MappingModel
appendXml(DOMNode $node)

Appends DOM elements to represent this object in XML.

VendorInfo addVendorInfo(VendorInfo|array $vendor)

Adds a new VendorInfo instance to this current model object.

from MappingModel
VendorInfo getVendorInfoForType(string $type)

Returns a VendorInfo object by its type.

from MappingModel
string getConfiguredBehavior(string $behavior)

Returns the best class name for a given behavior.

from MappingModel
string toString()

String representation of the current object.

from MappingModel
string __toString()

String representation of the current object.

from MappingModel
setName(string $name)

Sets the name of the Behavior

string getName()

Returns the name of the Behavior

setTable(Table $table)

Sets the table this behavior is applied to

Table getTable()

Returns the table this behavior is applied to

setDatabase(Database $database)

Sets the database this behavior is applied to

Database getDatabase()

Returns the table this behavior is applied to if behavior is applied to a database element.

addParameter(array $parameter)

Adds a single parameter.

setParameters(array $parameters)

Overrides the behavior parameters.

array getParameters()

Returns the associative array of parameters.

array getParameter(string $name)

Returns a single parameter by its name.

setTableModificationOrder(integer $tableModificationOrder)

Defines when this behavior must execute its modifyTable() method relative to other behaviors.

integer getTableModificationOrder()

Returns when this behavior must execute its modifyTable() method relative to other behaviors.

modifyDatabase()

This method is automatically called on database behaviors when the database model is finished.

modifyTable()

This method is automatically called on table behaviors when the database model is finished.

setTableModified(boolean $modified)

Sets whether or not the table has been modified.

boolean isTableModified()

Returns whether or not the table has been modified.

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.

Column getColumnForParameter(string $name)

Returns a column object using a name stored in the behavior parameters.

Behavior getTableModifier()

Returns the table modifier object.

Behavior getObjectBuilderModifier()

Returns the object builder modifier object.

Behavior getQueryBuilderModifier()

Returns the query builder modifier object.

Behavior getTableMapBuilderModifier()

Returns the table map builder modifier object.

boolean hasAdditionalBuilders()

Returns whether or not this behavior has additional builders.

array getAdditionalBuilders()

Returns the list of additional builder objects.

Details

in MappingModel at line 27
public __construct()

in MappingModel at line 38
public loadMapping(array $attributes)

Loads a mapping definition from an array.

Parameters

array $attributes

in MappingModel at line 58
public array getAttributes()

Returns all definition attributes.

All attribute names (keys) are lowercase.

Return Value

array

in MappingModel at line 73
public mixed getAttribute(string $name, mixed $default = null)

Returns a particular attribute by a case-insensitive name.

If the attribute is not set, then the second default value is
returned instead.

Parameters

string $name
mixed $default

Return Value

mixed

at line 280
public appendXml(DOMNode $node)

Appends DOM elements to represent this object in XML.

Parameters

DOMNode $node

in MappingModel at line 138
public VendorInfo addVendorInfo(VendorInfo|array $vendor)

Adds a new VendorInfo instance to this current model object.

Parameters

VendorInfo|array $vendor

Return Value

VendorInfo

in MappingModel at line 158
public VendorInfo getVendorInfoForType(string $type)

Returns a VendorInfo object by its type.

Parameters

string $type

Return Value

VendorInfo

in MappingModel at line 176
public string getConfiguredBehavior(string $behavior)

Returns the best class name for a given behavior.

If not found, the method tries to autoload \Propel\Generator\Behavior\[Bname]\[Bname]Behavior

Parameters

string $behavior The behavior name (ie: timestampable)

Return Value

string $class The behavior fully qualified class name

Exceptions

BehaviorNotFoundException

in MappingModel at line 198
public string toString()

String representation of the current object.

Return Value

string

in MappingModel at line 213
public string __toString()

String representation of the current object.

Return Value

string

at line 37
public setName(string $name)

Sets the name of the Behavior

Parameters

string $name the name of the behavior

at line 47
public string getName()

Returns the name of the Behavior

Return Value

string

at line 57
public setTable(Table $table)

Sets the table this behavior is applied to

Parameters

Table $table

at line 67
public Table getTable()

Returns the table this behavior is applied to

Return Value

Table

at line 77
public setDatabase(Database $database)

Sets the database this behavior is applied to

Parameters

Database $database

at line 88
public Database getDatabase()

Returns the table this behavior is applied to if behavior is applied to a database element.

Return Value

Database

at line 101
public addParameter(array $parameter)

Adds a single parameter.

Expects an associative array looking like
array('name' => 'foo', 'value' => bar)

Parameters

array $parameter

at line 114
public setParameters(array $parameters)

Overrides the behavior parameters.

Expects an associative array looking like array('foo' => 'bar').

Parameters

array $parameters

at line 124
public array getParameters()

Returns the associative array of parameters.

Return Value

array

at line 135
public array getParameter(string $name)

Returns a single parameter by its name.

Parameters

string $name

Return Value

array

at line 149
public setTableModificationOrder(integer $tableModificationOrder)

Defines when this behavior must execute its modifyTable() method relative to other behaviors.

The bigger the value is, the later the
behavior is executed.

Default is 50.

Parameters

integer $tableModificationOrder

at line 163
public integer getTableModificationOrder()

Returns when this behavior must execute its modifyTable() method relative to other behaviors.

The bigger the value is, the later the behavior is
executed.

Default is 50.

Return Value

integer

at line 175
public modifyDatabase()

This method is automatically called on database behaviors when the database model is finished.

Propagates the behavior to the tables of the database and override this
method to have a database behavior do something special.

at line 192
public modifyTable()

This method is automatically called on table behaviors when the database model is finished.

It also override it to add columns to the current
table.

at line 202
public setTableModified(boolean $modified)

Sets whether or not the table has been modified.

Parameters

boolean $modified

at line 212
public boolean isTableModified()

Returns whether or not the table has been modified.

Return Value

boolean

at line 227
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 270
public Column getColumnForParameter(string $name)

Returns a column object using a name stored in the behavior parameters.

Useful for table behaviors.

Parameters

string $name

Return Value

Column

at line 301
public Behavior getTableModifier()

Returns the table modifier object.

The current object is returned by default.

Return Value

Behavior

at line 313
public Behavior getObjectBuilderModifier()

Returns the object builder modifier object.

The current object is returned by default.

Return Value

Behavior

at line 325
public Behavior getQueryBuilderModifier()

Returns the query builder modifier object.

The current object is returned by default.

Return Value

Behavior

at line 337
public Behavior getTableMapBuilderModifier()

Returns the table map builder modifier object.

The current object is returned by default.

Return Value

Behavior

at line 347
public boolean hasAdditionalBuilders()

Returns whether or not this behavior has additional builders.

Return Value

boolean

at line 357
public array getAdditionalBuilders()

Returns the list of additional builder objects.

Return Value

array