Propel API
Class

Behavior

class Behavior extends XMLElement

Information about behaviors of a table.

Methods

loadFromXML(array $attributes)

This is the entry point method for loading data from XML.

from XMLElement
array getAttributes()

Returns the assoc array of attributes.

from XMLElement
mixed getAttribute(string $name, mixed $defaultValue = null)

Gets a particular attribute by [case-insensitive] name.

from XMLElement
appendXml(DOMNode $node)

VendorInfo addVendorInfo(mixed $data)

Sets an associated VendorInfo object.

from XMLElement
VendorInfo getVendorInfoForType($type)

Gets the any associated VendorInfo object.

from XMLElement
string getConfiguredBehavior(string $bname)

Find the best class name for a given behavior Looks in build.properties for path like propel.behavior.[bname].class If not found, tries to autoload [Bname]Behavior If no success, returns 'Behavior'

from XMLElement
toString()

String representation of the current object.

from XMLElement
__toString()

Magic string method

from XMLElement
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 <database> element.

addParameter(array $attribute)

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

setParameters(array $parameters)

Overrides the behavior parameters Expects an associative array looking like array('foo' => 'bar')

array getParameters()

Get the associative array of parameters

getParameter($name)

setTableModificationOrder($tableModificationOrder $tableModificationOrder)

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

integer getTableModificationOrder()

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

modifyDatabase()

This method is automatically called on database behaviors when the database model is finished Propagate the behavior to the tables of the database Override this method to have a database behavior do something special

modifyTable()

This method is automatically called on table behaviors when the database model is finished Override it to add columns to the current table

setTableModified($bool)

isTableModified()

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

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

ColumnMap getColumnForParameter(string $param)

Retrieve a column object using a name stored in the behavior parameters Useful for table behaviors

getTableModifier()

getObjectBuilderModifier()

getQueryBuilderModifier()

getPeerBuilderModifier()

getTableMapBuilderModifier()

hasAdditionalBuilders()

getAdditionalBuilders()

Details

in XMLElement at line 47
public loadFromXML(array $attributes)

This is the entry point method for loading data from XML.

It calls a setupObject() method that must be implemented by the child class.

Parameters

array $attributes The attributes for the XML tag.

in XMLElement at line 58
public array getAttributes()

Returns the assoc array of attributes.

All attribute names (keys) are lowercase.

Return Value

array

in XMLElement at line 70
public mixed getAttribute(string $name, mixed $defaultValue = null)

Gets a particular attribute by [case-insensitive] name.

If attribute is not set then the $defaultValue is returned.

Parameters

string $name The [case-insensitive] name of the attribute to lookup.
mixed $defaultValue The default value to use in case the attribute is not set.

Return Value

mixed The value of the attribute or $defaultValue if not set.

at line 259
public appendXml(DOMNode $node)

Parameters

DOMNode $node

See also

parent::appendXml(DOMNode)

in XMLElement at line 106
public VendorInfo addVendorInfo(mixed $data)

Sets an associated VendorInfo object.

Parameters

mixed $data VendorInfo object or XML attrib data (array)

Return Value

VendorInfo

in XMLElement at line 123
public VendorInfo getVendorInfoForType($type)

Gets the any associated VendorInfo object.

Parameters

$type

Return Value

VendorInfo

in XMLElement at line 142
public string getConfiguredBehavior(string $bname)

Find the best class name for a given behavior Looks in build.properties for path like propel.behavior.[bname].class If not found, tries to autoload [Bname]Behavior If no success, returns 'Behavior'

Parameters

string $bname behavior name, e.g. 'timestampable'

Return Value

string behavior class name, e.g. 'TimestampableBehavior'

in XMLElement at line 165
public toString()

String representation of the current object.

This is an xml representation with the XML declaration removed.

See also

appendXml()

in XMLElement at line 178
public __toString()

Magic string method

See also

toString()

at line 38
public setName(string $name)

Sets the name of the Behavior

Parameters

string $name the name of the behavior

at line 48
public string getName()

Returns the name of the Behavior

Return Value

string

at line 58
public setTable(Table $table)

Sets the table this behavior is applied to

Parameters

Table $table the table this behavior is applied to

at line 68
public Table getTable()

Returns the table this behavior is applied to

Return Value

Table

at line 78
public setDatabase(Database $database)

Sets the database this behavior is applied to

Parameters

Database $database the database this behavior is applied to

at line 88
public Database getDatabase()

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

Return Value

Database

at line 99
public addParameter(array $attribute)

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

Parameters

array $attribute associative array with name and value keys

at line 111
public setParameters(array $parameters)

Overrides the behavior parameters Expects an associative array looking like array('foo' => 'bar')

Parameters

array $parameters associative array

at line 120
public array getParameters()

Get the associative array of parameters

Return Value

array

at line 125
public getParameter($name)

Parameters

$name

at line 140
public setTableModificationOrder($tableModificationOrder $tableModificationOrder)

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

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

Parameters

$tableModificationOrder $tableModificationOrder integer

at line 151
public integer getTableModificationOrder()

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

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

Return Value

integer

at line 161
public modifyDatabase()

This method is automatically called on database behaviors when the database model is finished Propagate the behavior to the tables of the database Override this method to have a database behavior do something special

at line 177
public modifyTable()

This method is automatically called on table behaviors when the database model is finished Override it to add columns to the current table

at line 181
public setTableModified($bool)

Parameters

$bool

at line 186
public isTableModified()

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

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

Parameters

string $filename The template file name, relative to the behavior's dirname
array $vars An associative array of argumens to be rendered
string $templateDir The name of the template subdirectory

Return Value

string The rendered template

at line 242
public ColumnMap getColumnForParameter(string $param)

Retrieve a column object using a name stored in the behavior parameters Useful for table behaviors

Parameters

string $param Name of the parameter storing the column name

Return Value

ColumnMap The column of the table supporting the behavior

at line 273
public getTableModifier()

at line 278
public getObjectBuilderModifier()

at line 283
public getQueryBuilderModifier()

at line 288
public getPeerBuilderModifier()

at line 293
public getTableMapBuilderModifier()

at line 298
public hasAdditionalBuilders()

at line 303
public getAdditionalBuilders()