Contains logic for invoking an application rule.
Combined with {@link \Cake\Datasource\RulesChecker} as an implementation detail to de-duplicate rule decoration and provide cleaner separation of duties.
Constructor
Invoke the rule.
Set the rule name.
Set options for the rule invocation.
__construct(callable $rule, ?string $name, array<string, mixed> $options = [])
Constructor
errorField The field errors should be set onto.message The error message.Individual rules may have additional options that can be set here. Any options will be passed into the rule as part of the rule $scope.
callable $rule The rule to be invoked.
?string $name The name of the rule. Used in error messages.
array<string, mixed> $options optional The options for the rule. See above.
__invoke(Cake\Datasource\EntityInterface $entity, array $scope): bool
Invoke the rule.
Cake\Datasource\EntityInterface $entity The entity the rule should apply to.
array $scope The rule's scope/options.
boolsetName(string|null $name): $this
Set the rule name.
Only truthy names will be set.
string|null $name The name to set.
$thissetOptions(array<string, mixed> $options): $this
Set options for the rule invocation.
Old options will be merged with the new ones.
array<string, mixed> $options The options to set.
$thisThe rule name
string|nullRule options
array<string, mixed>Rule callable
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.4/class-Cake.Datasource.RuleInvoker.html