mirror of
https://github.com/doctrine/orm.git
synced 2026-03-23 22:42:18 +01:00
DDC-1336: em::transactional() returns TRUE if I return FALSE in the closure #1673
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @doctrinebot on GitHub (Aug 17, 2011).
Originally assigned to: @beberlei on GitHub.
Jira issue originally created by user ambis:
In short:
Best fix I think would be just to return whatever the closure returns, be it null, boolean or otherwise.
@doctrinebot commented on GitHub (Aug 17, 2011):
Comment created by ambis:
While this might be a bug in it's own right, I just realized that I did this a bit wrong in the first place.
I shouldn't return false in the closure when something goes wrong, but to throw an exception so that the transaction is rolled ba... No wait... But then it'll re-throw the exception and I need to wrap the ::transactional() in try catch... Huh!
What if:
This way you could silently abort the whole thing by returning false in the closure.
@doctrinebot commented on GitHub (Nov 19, 2011):
Comment created by @beberlei:
The way out this method in case of error is rollback + exception. You will need to catch this exception again, but at a higher level of your application when errors are logged and error pages shown.
If you need another behavior you should implement your own method.
Since the method has no @return docblock we cant assume what the correct behavior is, since none is defined. The code has to stay this way now because of Backwards compatibility reasons.
@doctrinebot commented on GitHub (Nov 19, 2011):
Issue was closed with resolution "Invalid"