diff --git a/CHANGELOG.md b/CHANGELOG.md index b504e15..8dd5a64 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +## Version 0.1.10 + +- Fix entity manager remove + ## Version 0.1.9 - Add REGEXP and REGEXP_REPLACE in SQLite diff --git a/src/Doctrine/EntityManagerWrapper.php b/src/Doctrine/EntityManagerWrapper.php index 249dfcf..e809e87 100644 --- a/src/Doctrine/EntityManagerWrapper.php +++ b/src/Doctrine/EntityManagerWrapper.php @@ -226,7 +226,7 @@ public function persist($object): void /** {@inheritdoc} */ public function remove($object): void { - $this->getEntityManager()->refresh($object); + $this->getEntityManager()->remove($object); } /** {@inheritdoc} */ diff --git a/tests/Manager/FixturesInteractionTest.php b/tests/Manager/FixturesInteractionTest.php index c651213..207de86 100644 --- a/tests/Manager/FixturesInteractionTest.php +++ b/tests/Manager/FixturesInteractionTest.php @@ -52,15 +52,13 @@ public function testCreateEntity(): void public function testDeleteEntity(): void { - $this->markTestSkipped('This is a bug, the entity is apparently not deleted after a remove and a flush.'); - $entity = $this->getReference(DummyEntity::class, 'number-1'); + $previousId = $entity->getId(); self::assertInstanceOf(DummyEntity::class, $entity); $this->getManager()->remove($entity); $this->getManager()->flush(); - $updatedEntity = $this->getRepository(DummyEntity::class)->findOneBy(['reference' => 'number-1']); - $this->getManager()->refresh($entity); + $updatedEntity = $this->getRepository(DummyEntity::class)->find($previousId); self::assertNull($entity->getId()); self::assertNull($updatedEntity); }