inklabs / kommerce-core

PHP shopping cart core platform
https://kommerce-laravel-demo.jamieisaacs.com/
Apache License 2.0
65 stars 14 forks source link

Remove dispatching Events from the Service layer. #44

Closed pdt256 closed 8 years ago

pdt256 commented 8 years ago

This is no longer necessary since UUIDs are available.

Also update the README to reflect this:

Events can be dispatched directly in the service layer. This is usually done for Entity creation when you do not yet have access to the id generated by the repository.

pdt256 commented 8 years ago

The OrderCreatedFromCartEvent must be dispatched from OrderService::createOrderFromCart().

This guarantees an order is valid, products are reserved, payment is processed, and the repository saves the order.