jorge07 / symfony-6-es-cqrs-boilerplate

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

[Question] Deal with another entity and forms #221

Closed Romaixn closed 2 years ago

Romaixn commented 3 years ago

Hey ! Thanks for this boilerplate, I like it a lot !

Do you have any example of an usage of forms ? (with symfony/forms or with manual forms ?)

This is the only thing missing from this boilerplate, to be able to project in a real application

Thanks you ! :)

jorge07 commented 3 years ago

I don't have examples but happy to switch the sign up form into a symfony form as example to generate the Command dto

jorge07 commented 3 years ago

@Romaixn I've some questions

What do you want to archive with Forms?

Romaixn commented 3 years ago

It was mostly for CRUD operations. To have an example of good practices for integrating a simple CRUD with his UI representation too and its validations.

Like generate entire form with bin/console make:crud in vanilla Symfony app !

jorge07 commented 3 years ago

Ok, that's fine! I'll add a Task entity many to many with User, so I can show how to interact "between aggregates". Those tasks will be emitting events too, in a more generic way than Users, as User requires more granularity. I'll use a TaskFactory in domain with a SymfonyFormTaskFactory class implementing the CRUD operations there. Will open a PR this weekend for better tracking and get feedback

jorge07 commented 3 years ago

It took me months to find time for this but here is the initial implementation just open for feedback.

You can take some inspiration from here. I plan to edit many things but at least you can see the process. Main one, remove that many getters and setters from domain.

https://github.com/jorge07/symfony-5-es-cqrs-boilerplate/compare/demo-forms?expand=1

jorge07 commented 2 years ago

Closing for inactivity