From d14f79b97921d3f7fe18d6e3775bb52dd4b801df Mon Sep 17 00:00:00 2001 From: Benjamin Vison Date: Tue, 10 Apr 2018 09:10:28 -0400 Subject: [PATCH] Fixing temporarly collection changes sync state not updating --- EventListener/DoctrineEventSubscriber.php | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/EventListener/DoctrineEventSubscriber.php b/EventListener/DoctrineEventSubscriber.php index e1b8577..3a44566 100755 --- a/EventListener/DoctrineEventSubscriber.php +++ b/EventListener/DoctrineEventSubscriber.php @@ -25,7 +25,7 @@ public function getSubscribedEvents() 'preRemove', ); } - + public function onFlush(OnFlushEventArgs $args) { $em = $args->getEntityManager(); @@ -35,6 +35,10 @@ public function onFlush(OnFlushEventArgs $args) $identityMap = $uow->getIdentityMap(); + // ehhehehehee LOL + $deletedEntities = count($uow->getScheduledEntityDeletions()) > 0; + $insertedEntities = count($uow->getScheduledEntityInsertions()) > 0; + foreach($identityMap as $map) { foreach($map as $object) { $changes = $uow->getEntityChangeSet($object); @@ -49,6 +53,9 @@ public function onFlush(OnFlushEventArgs $args) } } + if($deletedEntities || $insertedEntities) + $somethingChanged = true; + foreach ($uow->getScheduledEntityUpdates() as $keyEntity => $entity) { $changes = $uow->getEntityChangeSet($entity); @@ -89,4 +96,4 @@ private function handleEntityChange(EntityManagerInterface $em, $entity) { } -} +} \ No newline at end of file