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); + } } }