ValidationRule object. Represents a validation method, error message and rules for applying such method to a field.
boolThe 'last' key
stringThe 'message' key
callable|stringThe 'on' key
arrayExtra arguments to be passed to the validation method
stringKey under which the object or class where the method to be used for validation will be found
callable|stringThe method to be called for a given scope
Constructor
Sets the rule properties from the rule entry in validate
Checks if the validation rule should be skipped
Returns the value of a property by name
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<string, mixed> $validator = [])
Constructor
array<string, mixed> $validator optional [optional] The validator properties
_addValidatorProps(array<string, mixed> $validator = []): void
Sets the rule properties from the rule entry in validate
array<string, mixed> $validator optional [optional]
void_skip(array<string, mixed> $context): bool
Checks if the validation rule should be skipped
array<string, mixed> $context A key value list of data that could be used as context during validation. Recognized keys are:
boolget(string $property): mixed
Returns the value of a property by name
string $property The name of the property to retrieve.
mixedisLast(): bool
Returns whether this rule should break validation process for associated field after it fails
boolprocess(mixed $value, array<string, mixed> $providers, array<string, mixed> $context = []): array|string|bool
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<string, mixed> $providers Associative array with objects or class names that will be passed as the last argument for the validation method
array<string, mixed> $context optional A key value list of data that could be used as context during validation. Recognized keys are:
array|string|boolInvalidArgumentExceptionThe 'last' key
boolThe 'message' key
stringThe 'on' key
callable|stringExtra arguments to be passed to the validation method
arrayKey under which the object or class where the method to be used for validation will be found
stringThe method to be called for a given scope
callable|string
© 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.4/class-Cake.Validation.ValidationRule.html