CakeValidationSet object. Holds all validation rules for a field and exposes methods to dynamically add or remove validation rules
$_methods
protected array
$_rules
protected $_validationDomain
protected string
$field
public string
$isStopped
public boolean
$ruleSet
public array
Runs all validation rules in this set and returns a list of validation errors
__construct( string $fieldName , array $ruleSet )
Constructor
$fieldName
$ruleSet
_processValidationResponse( string $name , CakeValidationRule $rule )
Fetches the correct error message for a failed validation
$name
CakeValidationRule
$rule
_translateArgs( array $args )
Applies translations to validator arguments.
$args
count( )
Returns the number of rules in this set
Countable::count()
getIterator( )
Returns an iterator for each of the rules to be applied
IteratorAggregate::getIterator()
getRule( string $name )
Gets a rule for a given name if exists
$name
CakeValidationRule
getRules( )
Returns all rules for this validation set
CakeValidationRule[]
offsetExists( string $index )
Returns whether an index exists in the rule set
$index
ArrayAccess::offsetExists()
offsetGet( string $index )
Returns a rule object by its index
$index
CakeValidationRule
ArrayAccess::offsetGet()
offsetSet( string $index , CakeValidationRule|array $rule )
Sets or replace a validation rule.
This is a wrapper for ArrayAccess. Use setRule() directly for chainable access.
$index
CakeValidationRule
|array $rule
ArrayAccess::offsetSet()
offsetUnset( string $index )
Unsets a validation rule
$index
ArrayAccess::offsetUnset()
removeRule( string $name )
Removes a validation rule from the set
$set ->removeRule('required') ->removeRule('inRange')
$name
CakeValidationSet
setMethods( array $methods )
Sets the list of methods to use for validation
$methods
setRule( string $name , CakeValidationRule|array $rule )
Sets a CakeValidationRule $rule with a $name
$set ->setRule('required', array('rule' => 'notBlank', 'required' => true)) ->setRule('between', array('rule' => array('lengthBetween', 4, 10))
$name
CakeValidationRule
|array $rule
CakeValidationSet
setRules( array $rules array() , boolean $mergeVars true )
Sets the rules for a given field
$set->setRules(array( 'required' => array('rule' => 'notBlank', 'required' => true), 'inRange' => array('rule' => array('between', 4, 10) ));
$rules
optional array() $mergeVars
optional true CakeValidationSet
setValidationDomain( string $validationDomain )
Sets the I18n domain for validation messages.
$validationDomain
validate( array $data , boolean $isUpdate false )
Runs all validation rules in this set and returns a list of validation errors
$data
$isUpdate
optional false
© 2005–2016 The Cake Software Foundation, Inc.
Licensed under the MIT License.
CakePHP is a registered trademark of Cake Software Foundation, Inc.
We are not endorsed by or affiliated with CakePHP.
http://api.cakephp.org/2.8/class-CakeValidationSet.html