Skip to content

Loading…

DDC-415: Introduce UnitOfWork Stages and throw exceptions for wrong method uses #4908

Open
doctrinebot opened this Issue · 1 comment

1 participant

@doctrinebot

Jira issue originally created by user @beberlei:

Currently the event architecture is fragile when used wrong. I already see lots of "bug reports" popping up on this issue due to people dont understanding what is doable and what is not.

How about we introduce an instance variable stage into the UnitOfWork and introduce an assertIsInStages($stages) protected method which is called ineach major command method of the UnitOfWork to verify its applied correctly?

Stages could be:

UNFLUSHED
PRECOMPUTECHANGESETS
POSTCOMPUTECHANGESETS
FLUSH_LOOP
TRANSACTION_COMPLETED

@doctrinebot

Comment created by romanb:

I'm not sure. I'm afraid this will just add code bloat with the only goal to provide better error messages and its fragile to do right. There will surely be places missed in the code where to check for the stage and it might even constrain some valid use-cases we dont think of yet.

So I'm afraid that this would hurt more than it would help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.