Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Context Providers should also receive the state if exists #32

Open
Mark-Kiss opened this issue Mar 9, 2021 · 2 comments
Open

Context Providers should also receive the state if exists #32

Mark-Kiss opened this issue Mar 9, 2021 · 2 comments

Comments

@Mark-Kiss
Copy link

Mark-Kiss commented Mar 9, 2021

Same as for the callSubsequentAggregateFunction context provider should receive the $aggregateState when $this->createAggregate is false.

It's also not clear from the documentation, neither from the code what are the possible arguments for context providers, and aggregate handlers: this should be better communicated.

@codeliner
Copy link
Contributor

codeliner commented Mar 13, 2021

Event engine only passes the current command to a context provider. I get your idea and agree that it could be useful, but changing the behavior would require a change in the Flavour interface and that's something I'd like to avoid at the moment.
As an alternative you can inject the Event Engine into your context provider and get the aggregate state from it. Aggregate state is cached in memory until next save happens, so Event Engine won't load the state twice.

@codeliner
Copy link
Contributor

I keep the issue open as a reminder for documentation and possible improvement for next major release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants