Recording events from AggregatePartial #374
Unanswered
giorgiopogliani
asked this question in
Q&A
Replies: 1 comment 3 replies
-
@freekmurze is recording events from partials not supported by the package? Shouldn't it work? |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello, to give some context the scenario I was in is: trying to send a notification when a user is tagged in some content.
I created the
EntryAggregateRoot
which has a method to update the contentupdateEntryContent(string $content)
.Next I created a
MentionsAggregatePartial
to keep things separated because I might use it on some other content columnAlso, to be able to add partials from packages I overrode the method
resolvePartials
like so:Everything seemed to work perfectly! But only the first time, the second update triggered the exception:
Could not persist aggregate EntryAggregateRoot .... because it seems to be changed by another process after it was retrieved in the current process. Expect to persist events after version 21, but version 20 was already persisted.
So I inspected the source code and I come up this change that fixed the problem:
Now everything works but I am not sure if this has some consequences. Also, I cannot really do that change without reflection magic because some property on the abstract class are private.
I'll wait some comments/feedbacks, thanks!
Beta Was this translation helpful? Give feedback.
All reactions