$_rules
$_rules : array<mixed,\Cake\Validation\ValidationRule>
Holds the ValidationRule objects
ValidationSet object. Holds all validation rules for a field and exposes methods to dynamically add or remove validation rules
$_rules : array<mixed,\Cake\Validation\ValidationRule>
Holds the ValidationRule objects
isPresenceRequired(boolean|string|callable|null $validatePresent = null) : boolean|string|callable
Sets whether a field is required to be present in data array.
If no argument is passed the currently set validatePresent
value will be returned.
boolean|string|callable|null | $validatePresent | Deprecated since 3.6.0 ValidationSet::isPresenceRequired() is deprecated as a setter Use ValidationSet::requirePresence() instead. |
isEmptyAllowed(boolean|string|callable|null $allowEmpty = null) : boolean|string|callable
Sets whether a field value is allowed to be empty.
If no argument is passed the currently set allowEmpty
value will be returned.
boolean|string|callable|null | $allowEmpty | Deprecated since 3.6.0 ValidationSet::isEmptyAllowed() is deprecated as a setter. Use ValidationSet::allowEmpty() instead. |
rule(string $name) : \Cake\Validation\ValidationRule|null
Gets a rule for a given name if exists
string | $name | The name under which the rule is set. |
rules() : array<mixed,\Cake\Validation\ValidationRule>
Returns all rules for this validation set
add(string $name, \Cake\Validation\ValidationRule|array $rule) : $this
Sets a ValidationRule $rule with a $name
$set
->add('notBlank', ['rule' => 'notBlank'])
->add('inRange', ['rule' => ['between', 4, 10])
string | $name | The name under which the rule should be set |
\Cake\Validation\ValidationRule|array | $rule | The validation rule to be set |
offsetGet(string $index) : \Cake\Validation\ValidationRule
Returns a rule object by its index
string | $index | name of the rule |
offsetSet(string $index, \Cake\Validation\ValidationRule|array $rule) : void
Sets or replace a validation rule
string | $index | name of the rule |
\Cake\Validation\ValidationRule|array | $rule | Rule to add to $index |
Loading…