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