Skip to content

Commit

Permalink
Fix for refreshing deleted resource
Browse files Browse the repository at this point in the history
  • Loading branch information
leszczuu committed Sep 26, 2024
1 parent c44b376 commit 96cacd7
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/Refresher/ResourceRefresher.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
}

0 comments on commit 96cacd7

Please sign in to comment.