Skip to content

Conversation

@gubler
Copy link

@gubler gubler commented Feb 24, 2019

The current PR is for HandleMessageInNewTransaction middleware instead of the original RecordsMessages middleware. This documentation covers the new middleware.

The current PR is for HandleMessageInNewTransaction middleware instead of the original RecordsMessages middleware. This documentation covers the new middleware.
Copy link
Owner

@Nyholm Nyholm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you

**Solution:** The solution is to not dispatch the ``UserCreated`` event in the
``CreateUserHandler`` but to just "record" the events. The recorded events will
be dispatched after ``DoctrineTransactionMiddleware`` has committed the transaction.
**Problem 2:** If an exception is thrown when saving the user to the database, the welcome
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, I've never thought about this. That is true. Thanks

@Nyholm Nyholm merged commit ed06dc0 into Nyholm:message-recorder Feb 24, 2019
@Nyholm
Copy link
Owner

Nyholm commented Feb 24, 2019

Your changes has been merged and are now visible on symfony#10015

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

Successfully merging this pull request may close these issues.

2 participants