Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[DoctrineBundle] split Registry::getEntityManager() in two methods
Resetting an entity manager has a lot of consequences and the developer should be aware of that. So, instead of implicitly reset an entity manager when it is closed, the developer should reset it by hand if he thinks that this is possible: $em = $this->get('registry')->getEntityManager(); $em->getConnection()->beginTransaction(); // suspend auto-commit try { //... do some work } catch (Exception $e) { $em->getConnection()->rollback(); $em->close(); $this->get('registry')->resetEntityManager(); } // you will get a new one $em = $this->get('registry')->getEntityManager();
- Loading branch information