Propel API
Class

Validator

class Validator extends XMLElement

Validator.

Constants

TRANSLATE_NONE

TRANSLATE_GETTEXT

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
Rule addRule(mixed $data)

Add a Rule to this validator.

array getRules()

Gets an array of all added rules for this validator.

string getColumnName()

Gets the name of the column that this Validator applies to.

setColumn(Column $column)

Sets the Column object that this validator applies to.

Column getColumn()

Gets the Column object that this validator applies to.

setTable(Table $table)

Set the owning Table.

Table getTable()

Get the owning Table.

setTranslate(string $method)

Set the translation mode to use for the message.

string getTranslate()

Get the translation mode to use for the message.

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 169
public appendXml(DOMNode $node)

Parameters

DOMNode $node

See also

XMLElement::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 75
public Rule addRule(mixed $data)

Add a Rule to this validator.

Supports two signatures:
- addRule(Rule $rule)
- addRule(array $attribs)

Parameters

mixed $data Rule object or XML attribs (array) from <rule/> element.

Return Value

Rule The added Rule.

at line 95
public array getRules()

Gets an array of all added rules for this validator.

Return Value

array Rule[]

at line 104
public string getColumnName()

Gets the name of the column that this Validator applies to.

Return Value

string

at line 114
public setColumn(Column $column)

Sets the Column object that this validator applies to.

Parameters

Column $column

See also

Table::addValidator()

at line 123
public Column getColumn()

Gets the Column object that this validator applies to.

Return Value

Column

at line 132
public setTable(Table $table)

Set the owning Table.

Parameters

Table $table

at line 141
public Table getTable()

Get the owning Table.

Return Value

Table

at line 151
public setTranslate(string $method)

Set the translation mode to use for the message.

Currently only "gettext" and "none" are supported. The default is "none".

Parameters

string $method Translation method ("gettext", "none").

at line 161
public string getTranslate()

Get the translation mode to use for the message.

Currently only "gettext" and "none" are supported. The default is "none".

Return Value

string Translation method ("gettext", "none").