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

Add a new feature to the hall of fame to demonstrate how to check uniqueness #92

Closed
lucascourot opened this issue Oct 21, 2016 · 0 comments
Closed

Comments

@lucascourot
Copy link
Contributor

@lucascourot lucascourot commented Oct 21, 2016

As we talked on Gitter with @codeliner , I would be interested to demonstrate the use of domain services to check, let's say, the uniqueness of an email address.

Example: Check that the user's email is not already used while registering a new user. At the moment, you can register twice with the same email address (when pressing the previous button and filling the registration form again).

Another improvement proposed by @bweston92 :

you wouldn't even do new DateTimeImmutable as it is data relied from the system so you'd have a Clock interface that would give you this information.

How

  • Create a Service Interface in the Domain and its implementation in the Infrastructure.
  • Pass it to the command handler so it passes it to the aggregate root's method.
  • The aggregate root uses the domain service for its business rule.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.