diff --git a/src/Repository/VersionRepository.php b/src/Repository/VersionRepository.php index 46b74eaa..a436da15 100644 --- a/src/Repository/VersionRepository.php +++ b/src/Repository/VersionRepository.php @@ -25,12 +25,11 @@ public function __construct(ManagerRegistry $registry) public function remove(UuidInterface $id): void { - $version = $this->find($id); - if (!$version instanceof Version) { - throw new \InvalidArgumentException(sprintf('Version %s not found.', $id->toString())); - } - - $this->_em->remove($version); - $this->_em->flush(); + $this->_em->createQueryBuilder() + ->delete(Version::class, 'v') + ->where('v.id = :id') + ->setParameter('id', $id) + ->getQuery() + ->execute(); } } diff --git a/tests/Integration/Repository/VersionRepositoryTest.php b/tests/Integration/Repository/VersionRepositoryTest.php deleted file mode 100644 index ab91a3ce..00000000 --- a/tests/Integration/Repository/VersionRepositoryTest.php +++ /dev/null @@ -1,27 +0,0 @@ -container()->get(VersionRepository::class); - $id = Uuid::uuid4(); - - $exception = null; - try { - $repo->remove($id); - } catch (\Exception $exception) { - } - - self::assertInstanceOf(\InvalidArgumentException::class, $exception); - self::assertEquals($exception->getMessage(), "Version {$id->toString()} not found."); - } -}