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

Comments about AnnotatedCommandHandler #2

Open
prolic opened this issue Feb 19, 2017 · 2 comments
Open

Comments about AnnotatedCommandHandler #2

prolic opened this issue Feb 19, 2017 · 2 comments

Comments

@prolic
Copy link
Member

prolic commented Feb 19, 2017

see: https://github.com/mrook/annotations/blob/master/src/AnnotatedCommandHandler.php#L69

As you can see here https://github.com/prooph/event-sourcing/blob/develop/src/AggregateRoot.php#L46 the constructor is already protected. So an aggregate root will only be created by static methods, not by the constructor.

@prolic
Copy link
Member Author

prolic commented Feb 19, 2017

https://github.com/mrook/annotations/blob/master/src/AnnotatedCommandHandler.php#L58-L76

I would do that within the onRouteMessage() method, there is no need to create all handlers upfront, when only a single one is used.

@mrook
Copy link
Contributor

mrook commented Feb 22, 2017

@prolic the idea here is that an aggregate root (especially when written as a POPO) could (should?) have a constructor method as a command handler.

As for the onRouteMessage() comment, my comment re caching in EventHandlerInspector applies here as well.

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