Skip to content

Commit

Permalink
Fix entity manager remove
Browse files Browse the repository at this point in the history
  • Loading branch information
NicolasGuilloux committed Sep 29, 2021
1 parent 934d939 commit 045ef24
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## Version 0.1.10

- Fix entity manager remove

## Version 0.1.9

- Add REGEXP and REGEXP_REPLACE in SQLite
Expand Down
2 changes: 1 addition & 1 deletion src/Doctrine/EntityManagerWrapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ public function persist($object): void
/** {@inheritdoc} */
public function remove($object): void
{
$this->getEntityManager()->refresh($object);
$this->getEntityManager()->remove($object);
}

/** {@inheritdoc} */
Expand Down
6 changes: 2 additions & 4 deletions tests/Manager/FixturesInteractionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down

0 comments on commit 045ef24

Please sign in to comment.