When a entityManager does a flush
and this flush throws an exception. The doctrine entity manager will catch this exception clear the unit of work and mark the connection
as closed and then doing the rollback (https://github.com/doctrine/doctrine2/blob/v2.5.6/lib/Doctrine/ORM/UnitOfWork.php#L412-L417).
I need to restore the connection but as there is no method with does $this->closed = false
in the entityManager I'm confused how to handle this that after a failed flush
I can flush
another entity to mark this to mark in the database a specific task as failed! Also I can not run multiple tasks when a previous one failed the other can not run when when using the entityManager.
TL;DR So what is the best practice to restore the connection after a failed flush? As I see it is just marked as closed and is still connected but I dont want to use something dirty like Reflection or an custom entity manager to restore my connection.