Skip to content

Commit

Permalink
Fixing temporarly collection changes sync state not updating
Browse files Browse the repository at this point in the history
  • Loading branch information
Benjamin Vison committed Apr 10, 2018
1 parent a9c4d51 commit d14f79b
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions EventListener/DoctrineEventSubscriber.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public function getSubscribedEvents()
'preRemove',
);
}

public function onFlush(OnFlushEventArgs $args)
{
$em = $args->getEntityManager();
Expand All @@ -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);
Expand All @@ -49,6 +53,9 @@ public function onFlush(OnFlushEventArgs $args)
}
}

if($deletedEntities || $insertedEntities)
$somethingChanged = true;

foreach ($uow->getScheduledEntityUpdates() as $keyEntity => $entity) {
$changes = $uow->getEntityChangeSet($entity);

Expand Down Expand Up @@ -89,4 +96,4 @@ private function handleEntityChange(EntityManagerInterface $em, $entity) {
}


}
}

0 comments on commit d14f79b

Please sign in to comment.