ValidationRule object. Represents a validation method, error message and rules for applying such method to a field.
bool
The 'last' key
string
The 'message' key
string|callable
The 'on' key
array
Extra arguments to be passed to the validation method
string
Key under which the object or class where the method to be used for validation will be found
string|callable
The method to be called for a given scope
Returns whether this rule should break validation process for associated field after it fails
Dispatches the validation rule to the given validator method and returns a boolean indicating whether the rule passed or not. If a string is returned it is assumed that the rule failed and the error message was given as a result.
__construct(array $validator)
Constructor
array
$validator optional [optional] The validator properties
_addValidatorProps(array $validator)
Sets the rule properties from the rule entry in validate
array
$validator optional [optional]
_skip(array $context)
Checks if the validation rule should be skipped
array
$context A key value list of data that could be used as context during validation. Recognized keys are:
bool
True if the ValidationRule should be skipped
get(string $property)
Returns the value of a property by name
string
$property The name of the property to retrieve.
mixed
isLast()
Returns whether this rule should break validation process for associated field after it fails
bool
process(mixed $value, array $providers, array $context)
Dispatches the validation rule to the given validator method and returns a boolean indicating whether the rule passed or not. If a string is returned it is assumed that the rule failed and the error message was given as a result.
mixed
$value The data to validate
array
$providers associative array with objects or class names that will be passed as the last argument for the validation method
array
$context optional A key value list of data that could be used as context during validation. Recognized keys are:
bool|string|array
InvalidArgumentException
The 'last' key
bool
The 'message' key
string
The 'on' key
string|callable
Extra arguments to be passed to the validation method
array
Key under which the object or class where the method to be used for validation will be found
string
The method to be called for a given scope
string|callable
© 2005–present 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.
https://api.cakephp.org/4.1/class-Cake.Validation.ValidationRule.html