Coder Social home page Coder Social logo

Comments (3)

aarongustafson avatar aarongustafson commented on July 27, 2024

Yeah, I’m running into this too. For instance when registering a user, I want to issue 3 commands:

  1. Create the User
  2. Send them the Activation email
  3. Log them in

This fails to work:

$this->execute(
        RegisterUserCommand::class,
        null, # when null, it’s really Input::all()
        # Decorators
        [
            'Acme\Decorators\AssignIdAsUUID',
            'Acme\Decorators\SplitUserName',
            'Acme\Decorators\RemoveFullName',
            'Acme\Decorators\AssignUserLanguage',
            'Acme\Decorators\LookupUserGravatar',
        ]
);

$this->execute(SendActivationEmailCommand::class, Input::only('email'));

$this->execute(BypassLoginCommand::class, Input::only('email'));

The decorators continue to survive the execution in the CommandBus. They really should be reset with each call to $this->execute(). I tried passing an empty array and that did not work either.

I’m going to see if I can ferret out the issue directly, but I would love to hear from @JeffreyWay on this one.

from commander.

bruno-barros avatar bruno-barros commented on July 27, 2024

humm the CommandBus should remove the decorator after excecute it. Another point to me is the result of decorators don't change the command object. I've expected the decorators to be transformers to. Am I missing something here?

from commander.

aarongustafson avatar aarongustafson commented on July 27, 2024

I found a solution. There is a bit of code duplication between the ValidatorCommandBus and the DefaultCommandBus, but without stepping on @JeffreyWay’s toes there, I’ve got a solution. I will set up a Pull Request momentarily.

from commander.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.