Event Condition Decorator
Use this decorator to allow your event listener to only be invoked if the if and/or unless conditions pass.
callableCallable
arrayDecorator options
Constructor.
Invoke
Calls the decorated callable with the passed arguments.
Evaluates the filter conditions
Checks if the event is triggered for this listener.
__construct(callable $callable, array<string, mixed> $options = [])
Constructor.
callable $callable Callable.
array<string, mixed> $options optional Decorator options.
__invoke(): mixed
Invoke
mixed_call(array $args): mixed
Calls the decorated callable with the passed arguments.
array $args Arguments for the callable.
mixed_evaluateCondition(string $condition, Cake\Event\EventInterface $event): bool
Evaluates the filter conditions
string $condition Condition type
Cake\Event\EventInterface $event Event object
boolcanTrigger(Cake\Event\EventInterface $event): bool
Checks if the event is triggered for this listener.
Cake\Event\EventInterface $event Event object.
boolCallable
callableDecorator options
array
© 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.Event.Decorator.ConditionDecorator.html