From 44b96395859fe0588d1bfabc93c31eec3c123837 Mon Sep 17 00:00:00 2001 From: AlekseyTkachenko Date: Thu, 23 Jun 2022 17:33:42 +0300 Subject: [PATCH] Add reopen method --- src/EntityManager.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/EntityManager.php b/src/EntityManager.php index 4c17d39..b655750 100644 --- a/src/EntityManager.php +++ b/src/EntityManager.php @@ -406,4 +406,14 @@ public function contains($object) { return $this->getWrappedEm()->contains($object); } + + public function reopen() : void + { + $em = $this->getWrappedEm(); + if ($em->isOpen()) { + $em->clear(); + } else { + $this->emStorage->offsetUnset($em); + } + } }