Skip to content

Commit

Permalink
Optimise delete query
Browse files Browse the repository at this point in the history
  • Loading branch information
karniv00l committed Aug 14, 2020
1 parent 0ba6a4d commit 825ab3f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 34 deletions.
13 changes: 6 additions & 7 deletions src/Repository/VersionRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
}
27 changes: 0 additions & 27 deletions tests/Integration/Repository/VersionRepositoryTest.php

This file was deleted.

0 comments on commit 825ab3f

Please sign in to comment.