protected shouldExecuteEvents ( |
||
$entity | the entity having the event chain to execute | |
$moment | string | the "moment" of the event, can be either "before" or "after" |
$action | string | the "action" of the event, can be either "create", "update" or "delete" |
return | boolean | true on successful execution of the full chain or false if it broke at any point (and stopped the execution) |
protected function shouldExecuteEvents(Entity $entity, $moment, $action)
{
if (!isset($this->events[$moment . '.' . $action])) {
return true;
}
foreach ($this->events[$moment . '.' . $action] as $event) {
$result = $event($entity);
if (!$result) {
return false;
}
}
return true;
}