Open utterances-bot opened 4 years ago
Really interesting and simple approach to Event Sourcing using Laravel, thanks for sharing your experiences. I would only like to suggest reviewing some parts of this article as I have the feeling you mixed the Products context with the Orders one when saying:
”That other event is part of the Product context“
Also you defined the $capacity property in one example and then used $stock on the constructor of one of your events.
Again, thank you very much for your article, it transmits very well the idea despite the issues.
Hey, great article. Can you add examples or just explain how to work with transactions with this approach? I am not sure that place event emitter inside "global" transaction is good idea... but its the first thing that comes in my mind. Thanks !
I was wondering how strict the order context have to be when looking at product data. I see stock is copied in to the order context, but not product unit price?
Also usually when throwing exceptions, i thought all events would be thrown out, but you are specifically rising an CouldNotCreateOrderBecauseInsufficientStock event at the same time?
I would love to hear your thoughts on the above, and thank you for these very educational posts!
Mixing event sourcing in a traditional Laravel app - Freek Van der Herten's blog on PHP, Laravel and JavaScript
Freek Van der Herten is a developer and partner at Spatie.
https://freek.dev/1634-mixing-event-sourcing-in-a-traditional-laravel-app