Use case:
I'm trying to use the user AR's as an identity for my permission checks. By coincidence I started to add permissions to the UserAR. For other AR's then Users this problem wouldn't surface.
https://gist.github.com/basz/86942655f534c34f984b5d43f0d79f66#file-gistfile1-txt-L65-L73
Digging into this I believe it happens because calling repo->get will always rebuild a new object and return that. Loosing events recorded on the first.
https://github.com/prooph/event-store/blob/master/src/Aggregate/AggregateRepository.php#L162
Is there a reason the repository doesn't return the cached version if it is available? Would it be bad if we add that?
Use case:
I'm trying to use the user AR's as an identity for my permission checks. By coincidence I started to add permissions to the UserAR. For other AR's then Users this problem wouldn't surface.
https://gist.github.com/basz/86942655f534c34f984b5d43f0d79f66#file-gistfile1-txt-L65-L73
Digging into this I believe it happens because calling repo->get will always rebuild a new object and return that. Loosing events recorded on the first.
https://github.com/prooph/event-store/blob/master/src/Aggregate/AggregateRepository.php#L162
Is there a reason the repository doesn't return the cached version if it is available? Would it be bad if we add that?