ValidationRule object. Represents a validation method, error message and rules for applying such method to a field.
$_last
protected boolean
$_message
protected string
$_on
protected string
$_pass
protected array
$_provider
protected string
Key under which the object or class where the method to be used for validation will be found
$_rule
protected string|callable
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
$validator
optional [] _addValidatorProps( array $validator [] )
Sets the rule properties from the rule entry in validate
$validator
optional [] _skip( array $context )
Checks if the validation rule should be skipped
$context
A key value list of data that could be used as context during validation. Recognized keys are: - newRecord: (boolean) whether or not the data to be validated belongs to a new record - data: The full data that was passed to the validation process - providers associative array with objects or class names that will be passed as the last argument for the validation method
get( string $property )
Returns the value of a property by name
$property
isLast( )
Returns whether this rule should break validation process for associated field after it fails
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.
$value
$providers
associative array with objects or class names that will be passed as the last argument for the validation method
$context
optional [] A key value list of data that could be used as context during validation. Recognized keys are: - newRecord: (boolean) whether or not the data to be validated belongs to a new record - data: The full data that was passed to the validation process - field: The name of the field that is being processed
when the supplied rule is not a valid callable for the configured scope
protected string
Key under which the object or class where the method to be used for validation will be found
'default'
© 2005–2017 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/3.4/class-Cake.Validation.ValidationRule.html