Propel 2 API
Class

Propel\Generator\Behavior\Validate\ValidateBehavior

class ValidateBehavior extends Behavior

Validate a model object using Symfony2 Validator component

Methods

setName(string $name)

Sets the name of the Behavior

from Behavior
string getName()

Returns the name of the Behavior

from Behavior
setTable(Table $table)

Sets the table this behavior is applied to

from Behavior
Table getTable()

Returns the table this behavior is applied to

from Behavior
setDatabase(Database $database)

Sets the database this behavior is applied to

from Behavior
Database getDatabase()

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

from Behavior
addParameter(array $parameter)

Adds a single parameter.

from Behavior
setParameters(array $parameters)

Overrides the behavior parameters.

from Behavior
array getParameters()

Returns the associative array of parameters.

from Behavior
array getParameter(string $name)

Returns a single parameter by its name.

from Behavior
setTableModificationOrder(integer $tableModificationOrder)

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

from Behavior
integer getTableModificationOrder()

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

from Behavior
modifyDatabase()

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

from Behavior
modifyTable()

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

from Behavior
setTableModified(boolean $modified)

Sets whether or not the table has been modified.

from Behavior
boolean isTableModified()

Returns whether or not the table has been modified.

from Behavior
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 Behavior
Column getColumnForParameter(string $name)

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

from Behavior
appendXml(DOMNode $node)

Appends DOM elements to represent this object in XML.

from Behavior
Behavior getTableModifier()

Returns the table modifier object.

from Behavior
Behavior getObjectBuilderModifier()

Returns the object builder modifier object.

from Behavior
Behavior getQueryBuilderModifier()

Returns the query builder modifier object.

from Behavior
Behavior getTableMapBuilderModifier()

Returns the table map builder modifier object.

from Behavior
boolean hasAdditionalBuilders()

Returns whether or not this behavior has additional builders.

from Behavior
array getAdditionalBuilders()

Returns the list of additional builder objects.

from Behavior
string objectMethods($builder)

Add behavior methods to model class

string objectAttributes()

Add behavior attributes to model class

array getParametersFromColumnName(string $columnName = null)

Returns the parameters associated with a given column.

removeParametersFromColumnName(string $columnName = null)

Remove parameters associated with given column.

addRuleOnPk()

Add a rule based on primary key type, if there aren't other parameters.

mergeParameters(array $params = null)

Merge $paramArray array into parameters array.

Details

in Behavior at line 37
public setName(string $name)

Sets the name of the Behavior

Parameters

string $name the name of the behavior

in Behavior at line 47
public string getName()

Returns the name of the Behavior

Return Value

string

in Behavior at line 57
public setTable(Table $table)

Sets the table this behavior is applied to

Parameters

Table $table

in Behavior at line 67
public Table getTable()

Returns the table this behavior is applied to

Return Value

Table

in Behavior at line 77
public setDatabase(Database $database)

Sets the database this behavior is applied to

Parameters

Database $database

in Behavior 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

in Behavior 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

in Behavior at line 114
public setParameters(array $parameters)

Overrides the behavior parameters.

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

Parameters

array $parameters

in Behavior at line 124
public array getParameters()

Returns the associative array of parameters.

Return Value

array

in Behavior at line 135
public array getParameter(string $name)

Returns a single parameter by its name.

Parameters

string $name

Return Value

array

in Behavior 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

in Behavior 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

in Behavior 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.

in Behavior 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.

in Behavior at line 202
public setTableModified(boolean $modified)

Sets whether or not the table has been modified.

Parameters

boolean $modified

in Behavior at line 212
public boolean isTableModified()

Returns whether or not the table has been modified.

Return Value

boolean

in Behavior 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

in Behavior 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

in Behavior at line 280
public appendXml(DOMNode $node)

Appends DOM elements to represent this object in XML.

Parameters

DOMNode $node

in Behavior at line 301
public Behavior getTableModifier()

Returns the table modifier object.

The current object is returned by default.

Return Value

Behavior

in Behavior at line 313
public Behavior getObjectBuilderModifier()

Returns the object builder modifier object.

The current object is returned by default.

Return Value

Behavior

in Behavior at line 325
public Behavior getQueryBuilderModifier()

Returns the query builder modifier object.

The current object is returned by default.

Return Value

Behavior

in Behavior at line 337
public Behavior getTableMapBuilderModifier()

Returns the table map builder modifier object.

The current object is returned by default.

Return Value

Behavior

in Behavior at line 347
public boolean hasAdditionalBuilders()

Returns whether or not this behavior has additional builders.

Return Value

boolean

in Behavior at line 357
public array getAdditionalBuilders()

Returns the list of additional builder objects.

Return Value

array

at line 35
public string objectMethods($builder)

Add behavior methods to model class

Parameters

$builder

Return Value

string

at line 66
public string objectAttributes()

Add behavior attributes to model class

Return Value

string The code to be added to model class

at line 78
public array getParametersFromColumnName(string $columnName = null)

Returns the parameters associated with a given column.

Useful for i18n behavior

Parameters

string $columnName The column name

Return Value

array The array of parameters associated to given column

at line 99
public removeParametersFromColumnName(string $columnName = null)

Remove parameters associated with given column.

Useful for i18n behavior

Parameters

string $columnName The column name

at line 120
public addRuleOnPk()

Add a rule based on primary key type, if there aren't other parameters.

Useful when modify table (i18n behavior).
If all the rules have been removed, the behavior can't perform validation on related tables.
This method introduce a rule to avoid this.

at line 140
public mergeParameters(array $params = null)

Merge $paramArray array into parameters array.

This method avoid that there are rules with the same name, when adding parameters programmatically.
Useful for Concrete Inheritance behavior.

Parameters

array $params