[DDC-415] Introduce UnitOfWork Stages and throw exceptions for wrong method uses Created: 12/Mar/10  Updated: 18/Mar/10

Status: Open
Project: Doctrine 2 - ORM
Component/s: ORM
Affects Version/s: 2.0-ALPHA4
Fix Version/s: None
Security Level: All

Type: Improvement Priority: Minor
Reporter: Benjamin Eberlei Assignee: Roman S. Borschel
Resolution: Unresolved Votes: 0
Labels: None


 Description   

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
PRE_COMPUTE_CHANGESETS
POST_COMPUTE_CHANGESETS
FLUSH_LOOP
TRANSACTION_COMPLETED



 Comments   
Comment by Roman S. Borschel [ 12/Mar/10 ]

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.

Generated at Wed Apr 23 12:05:36 UTC 2014 using JIRA 6.2.3#6260-sha1:63ef1d6dac3f4f4d7db4c1effd405ba38ccdc558.