From ae8d4f82f5e3417e7638f324dd3613cb3e7db4b2 Mon Sep 17 00:00:00 2001 From: Benjamin Vison Date: Sun, 18 Mar 2018 21:17:17 -0400 Subject: [PATCH] Fixed entity manager persisting invoice after detaching --- EventListener/DoctrineEventSubscriber.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/EventListener/DoctrineEventSubscriber.php b/EventListener/DoctrineEventSubscriber.php index 9aadd06..a2acc12 100755 --- a/EventListener/DoctrineEventSubscriber.php +++ b/EventListener/DoctrineEventSubscriber.php @@ -36,7 +36,8 @@ public function onFlush(OnFlushEventArgs $args) $changes = $uow->getEntityChangeSet($entity); if(count($changes) == 1 && isset($changes["lastTimestamp"])) { - $uow->detach($entity); + $oid = spl_object_hash($entity); + $uow->clearEntityChangeSet($oid); continue; } $this->handleEntityChange($em, $entity);