Skip to content

Commit

Permalink
Fix missing flush issue
Browse files Browse the repository at this point in the history
  • Loading branch information
mariusklocke committed Dec 6, 2023
1 parent 811448b commit d99ce00
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/Application/Repository/EntityRepositoryInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,9 @@ public function save($entity): void;
* @param object $entity
*/
public function delete($entity): void;

/**
* @return void
*/
public function flush(): void;
}
1 change: 1 addition & 0 deletions src/Infrastructure/API/Logos/DeleteAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ public function __invoke(ServerRequestInterface $request, ResponseInterface $res
$this->deleteLogo($team->getLogoId());
$team->setLogoId(null);
$this->teamRepository->save($team);
$this->teamRepository->flush();
$this->logger->info('Team logo has been deleted', [
'teamId' => $team->getId()
]);
Expand Down
1 change: 1 addition & 0 deletions src/Infrastructure/API/Logos/UploadAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ public function __invoke(ServerRequestInterface $request, ResponseInterface $res
$fileId = $this->saveLogo($file);
$team->setLogoId($fileId);
$this->teamRepository->save($team);
$this->teamRepository->flush();

$this->logger->info("Uploaded team logo has been saved", [
'teamId' => $team->getId(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,4 +94,9 @@ public function delete($entity): void
{
$this->manager->remove($entity);
}

public function flush(): void
{
$this->manager->flush();
}
}

0 comments on commit d99ce00

Please sign in to comment.