Skip to content

ADR - Middleware - CQRS/event sourcing #24

@devosc

Description

@devosc

I'm re-posting this here because it is the type of solution that I think can work for everyone and would work with existing code.

What I would like the ADR pattern to provide is a traversable set of callable types. During its traversal the ADR handler will determine what the next callable to use is and will return it so that the generator can either call it or create it and then call it. This would also allow callables to be skipped or jump to a different point in the queue depending on its state?

'controller' => new ControllerAction([
        function(array $args = []) {
            return new Model(null, ['args' => $args]); //$args are the named args
        },
        function(Model $model) {
            $model['__CONTROLLER__'] = __FUNCTION__; //demo check that is called..
            return $model;
        },
        function(Model $model, Response $response) {
            $model[$model::TEMPLATE] = 'home';

            return $model;

            //or
            $response->setContent($response);
            return $response; 
        },
]),

If one of the functions returns a Response the traversal is stopped

References:
Matthias' CQRS/event sourcing
Traversable Event

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions