Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ADR - Middleware - CQRS/event sourcing #24

Open
devosc opened this issue Nov 21, 2014 · 0 comments
Open

ADR - Middleware - CQRS/event sourcing #24

devosc opened this issue Nov 21, 2014 · 0 comments

Comments

@devosc
Copy link

devosc commented Nov 21, 2014

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant