Skip to content

Commit

Permalink
Update DoctrineEventSubscriber.php
Browse files Browse the repository at this point in the history
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
  • Loading branch information
bvisonl authored Jul 18, 2018
1 parent 2195d6b commit e84f8a9
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion EventSubscriber/DoctrineEventSubscriber.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
}

Expand Down

0 comments on commit e84f8a9

Please sign in to comment.