From e84f8a90b32ec63bfc4bf471c70a463a852a5544 Mon Sep 17 00:00:00 2001 From: Benjamin Vison Date: Wed, 18 Jul 2018 00:36:33 -0400 Subject: [PATCH] Update DoctrineEventSubscriber.php Fixing bug when the SyncState is created from the code it tried to recompute the change set on the new entity but it should be just computing the changeset --- EventSubscriber/DoctrineEventSubscriber.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/EventSubscriber/DoctrineEventSubscriber.php b/EventSubscriber/DoctrineEventSubscriber.php index c06d84d..acd0f97 100755 --- a/EventSubscriber/DoctrineEventSubscriber.php +++ b/EventSubscriber/DoctrineEventSubscriber.php @@ -96,7 +96,11 @@ private function processEntity(EntityManagerInterface $em, $entity, $deleting = } $syncState->setTimestamp($timestamp); if($uow->getEntityState($syncState) == UnitOfWork::STATE_MANAGED) { - $uow->recomputeSingleEntityChangeSet($em->getClassMetadata(SyncState::class), $syncState); + if($syncState->getId()) { + $uow->recomputeSingleEntityChangeSet($em->getClassMetadata(SyncState::class), $syncState); + } else { + $uow->computeChangeSet($em->getClassMetadata(SyncState::class), $syncState); + } } }