Class ConditionDecorator
Event Condition Decorator
Use this decorator to allow your event listener to only
be invoked if the if
and/or unless
conditions pass.
- Cake\Event\Decorator\AbstractDecorator
- Cake\Event\Decorator\ConditionDecorator
Method Summary
-
__invoke() public
Invoke -
_evaluateCondition() protected
Evaluates the filter conditions -
canTrigger() public
Checks if the event is triggered for this listener.
Method Detail
_evaluateCondition() protected ¶
_evaluateCondition( string $condition , Cake\Event\Event
$event )
Evaluates the filter conditions
Parameters
- string $condition
- Condition type
-
Cake\Event\Event
$event - Event object
Returns
boolean
canTrigger() public ¶
canTrigger( Cake\Event\Event
$event )
Checks if the event is triggered for this listener.
Parameters
-
Cake\Event\Event
$event - Event object.
Returns
boolean
Methods inherited from Cake\Event\Decorator\AbstractDecorator
__construct() public ¶
__construct( callable $callable , array $options [] )
Constructor.
Parameters
- callable $callable
- Callable.
- array $options optional []
- Decorator options.