aggregateVersion behavior in AggregateRoot apply method #199
Unanswered
qalqaman22dev
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
laravel-event-sourcing/src/AggregateRoots/AggregateRoot.php
Line 222 in 05d0aa0
Hello everyone.
Whether the aggregateVersion should be incremented if $applyMethodExists is false in apply() method, during reconstituteFromEvents()? (take a look at the above reference)
In the code, we are trying to make the check described below,, in order to additionally avoid, for example, an erroneous substitution of "productId" instead of "categoryId" in the "CategoryAggregate" or vice versa.
Now aggregateVersion depends on the number of events associated with "aggregateId" regardless of whether these events are related to the aggregate itself. Therefore, this check cannot take effect. I would like to know your opinions.
Beta Was this translation helpful? Give feedback.
All reactions