Skip to content

Commit

Permalink
Flush only resource that gets persisted
Browse files Browse the repository at this point in the history
  • Loading branch information
RandyCupic committed Oct 31, 2023
1 parent 2b38930 commit feae8b9
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions lib/Core/AbstractProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ public function store(RemoteResource $resource): RemoteResource
$resource->setUpdatedAt($this->dateTimeFactory->createCurrent());

$this->entityManager->persist($resource);
$this->entityManager->flush();
$this->entityManager->flush($resource);

return $resource;
}
Expand All @@ -140,7 +140,7 @@ public function store(RemoteResource $resource): RemoteResource

if (!$existingResource instanceof RemoteResource) {
$this->entityManager->persist($resource);
$this->entityManager->flush();
$this->entityManager->flush($resource);

return $resource;
}
Expand All @@ -149,15 +149,15 @@ public function store(RemoteResource $resource): RemoteResource
$existingResource->setUpdatedAt($this->dateTimeFactory->createCurrent());

$this->entityManager->persist($existingResource);
$this->entityManager->flush();
$this->entityManager->flush($existingResource);

return $existingResource;
}

public function remove(RemoteResource $resource): void
{
$this->entityManager->remove($resource);
$this->entityManager->flush();
$this->entityManager->flush($resource);

if ($this->shouldDeleteFromRemote && $this->supportsDelete()) {
$this->deleteFromRemote($resource);
Expand All @@ -181,15 +181,15 @@ public function loadLocation(int $id): RemoteResourceLocation
public function storeLocation(RemoteResourceLocation $location): RemoteResourceLocation
{
$this->entityManager->persist($location);
$this->entityManager->flush();
$this->entityManager->flush($location);

return $location;
}

public function removeLocation(RemoteResourceLocation $resourceLocation): void
{
$this->entityManager->remove($resourceLocation);
$this->entityManager->flush();
$this->entityManager->flush($resourceLocation);
}

public function loadNamedRemoteResource(string $name): RemoteResource
Expand Down

0 comments on commit feae8b9

Please sign in to comment.