src/CRUDlex/EntityEvents.php
public function shouldExecute(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;
    }
public function shouldExecute(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;
    }
public function shouldExecute ( 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 ; }
Executes the event chain of an entity.

@param Entity $entity
the entity having the event chain to execute
@param string $moment
the "moment" of the event, can be either "before" or "after"
@param string $action
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)
Executes the event chain of an entity .