joselfonseca / laravel-tactician

Laravel Tactician is an implementation of the Command Bus Tactician by Ross Tuck.
MIT License
61 stars 12 forks source link

What about Undo feature? #17

Open jagarsoft opened 3 years ago

jagarsoft commented 3 years ago

Hi folks What do you think about implementing Undo feature?

Comments will be welcomed!

I have started working on it

jagarsoft commented 3 years ago

No comments?

joselfonseca commented 3 years ago

hey there, I am not currently using this package too much. So if you think is a good addition you can make a PR and we can take a look. Thanks

jagarsoft commented 3 years ago

Thanks @joselfonseca

I made the following assumtions:

  1. "undo"/"redo" methods return the same than their contrapart, "dispatch", did (Memento Pattern)
  2. the array associated with the middleware when invoking the "dispatch" method will walk through in reversed order when you "undo" a command, whilst "redo" a command will process the same middlewares in normal order again
  3. "undo" invokes to "unHandle" method of command and "executeUndo" of middleware. There will be an Inflector Class for them

What do you think? Is it well aligned?