diff --git a/src/Refresher/ResourceRefresher.php b/src/Refresher/ResourceRefresher.php index 07494d48..bc0a6dce 100644 --- a/src/Refresher/ResourceRefresher.php +++ b/src/Refresher/ResourceRefresher.php @@ -19,7 +19,9 @@ final class ResourceRefresher implements ResourceRefresherInterface { public function refresh(ResourceInterface $resource, ObjectPersisterInterface $objectPersister): void { - $objectPersister->deleteById($resource->getId()); - $objectPersister->replaceOne($resource); + if ($resource->getId()) { + $objectPersister->deleteById($resource->getId()); + $objectPersister->replaceOne($resource); + } } }