mirror of
https://github.com/doctrine/orm.git
synced 2026-03-23 22:42:18 +01:00
Flushed changes not rolling back #5334
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 @chinmayshah24 on GitHub (Nov 26, 2016).
Originally assigned to: @Ocramius on GitHub.
What is the real purpose of
flushin doctrine? I am unable to use it in services properly. The changes are committed to the database regardless of any exceptions in processing. Should we just be usingpersistwrapped in atransactionalblock? This is my pseudo code:Same with the
transactionalclosure. Basically the same as this approach in the docs. I mean it's there in the docs, and i am trying that. What am i doing wrong?I don't even need to use
commit. What's going on?Is this a bug?
@Ocramius commented on GitHub (Nov 26, 2016):
No, a transaction will be rolled back if an
EntityManager#flush()fails:b06dcb89b3/lib/Doctrine/ORM/UnitOfWork.php (L402-L409)Same goes for the
EntityManager#transactional()API. You can find the implementation atb06dcb89b3/lib/Doctrine/ORM/EntityManager.php (L240-L245)@chinmayshah24 commented on GitHub (Nov 26, 2016):
My table was a MyISAM, as you suspected in the other thread
@Ocramius commented on GitHub (Nov 26, 2016):
Discussion reference: https://github.com/doctrine/doctrine2/issues/5759#issuecomment-263044242