jorge07 / symfony-6-es-cqrs-boilerplate

Symfony 6 DDD ES CQRS backend boilerplate.
MIT License
1.07k stars 187 forks source link

What is the idea behind repository and collection? #47

Closed 3amprogrammer closed 6 years ago

3amprogrammer commented 6 years ago

I see you have UserCollectionInterface and UserRepositoryInterface. Could you please tell me what is the difference and when should I use one over the other?

Awesome boilerplate! 🏅

pascal08 commented 6 years ago

I have been studying this repo too and so far I really like the idea behind this boilerplate. Though, I am missing documentation about the design intentions. I would be glad to help writing docs if we could sketch the outline of parts we need to fill in.

One of my questions, for example, is: why is league/tactican used as a command bus when broadway/broadway (which is included in this repo too) also has a command bus? Does league/tactican has a feature broadway/broadway is missing?

Again, I would be glad to help writing some docs.

jorge07 commented 6 years ago

Hey

I like the idea of document each layer or design decision. It will be good to open discussions about possible refactors.

About UserRepositoryInterface and UserCollectionInterface. The first one has historically implicit storage management while the second one not. Instead of UserCollectionInterface could be even better something like CheckUserByEmailInterface so the use case is completely isolated and a little bit more SOLID.

About the command bus. Tactician has much more community and also, the most important thing, return at resolver level. So you can return content from a handler. That's useless for command bus or event bus but needed for query bus. And have a query bus is very nice thing when dealing with caching and auth at read access.

As always if you think something can be done better PRs are welcome. :+1:

pascal08 commented 6 years ago

Alright. I think we should converge on the most valuable things to document for each of the implemented features. I have written down some questions that came up my mind that would help a newcomer to quickly grasp the design intentions.

Command Bus, Query Bus, Event Bus -- Why Tactician for Command/Query Bus? (A: because of the return at resolver level) Event Store -- How to replay events? Read Model -- How to build a projection? Async Event subscribers -- How do Symfony/RabbitMQ/ElasticSearch work together?

jorge07 commented 6 years ago

Can I close this @3amprogrammer @pascal08 ?

pascal08 commented 6 years ago

Thank you very much for documenting!