Eloquent
Last updated
Was this helpful?
Last updated
Was this helpful?
Ecotone comes with out of the box integration with Eloquent for . If you've installed Laravel, then you may start using Eloquent based Aggregates.
Mark your Models with Aggregate attribute and set up Command Handlers.
Calling factory method "issue.report":
Calling action method "issue.close":
Aggregates require state to be always valid. If we have auto-generated identifiers from database, then in order to be assured that returned Issue
has id, we need to call save
.
If you generate identifiers outside of the database, this step is not needed.
Event publishing - if we have imported trait WithEvents
, then we can publish events from the Aggregate using recordThat method.
In case of Ecotone you may use routing for your Message Handlers or direct Message Classes. It's up to you to decide whatever works best in your context.
Read more about integration in .