From 28a4f6364013622256780dec556c77bba39a4ad8 Mon Sep 17 00:00:00 2001 From: Simon Vieille Date: Thu, 28 Sep 2023 10:32:49 +0200 Subject: [PATCH] fix compatibility of TranslatableEntityManager with the entity manager --- src/core/Manager/TranslatableEntityManager.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/core/Manager/TranslatableEntityManager.php b/src/core/Manager/TranslatableEntityManager.php index 2cb87a0..64a7d89 100644 --- a/src/core/Manager/TranslatableEntityManager.php +++ b/src/core/Manager/TranslatableEntityManager.php @@ -11,10 +11,13 @@ use App\Core\Entity\EntityInterface; */ class TranslatableEntityManager extends EntityManager { - protected function persist(EntityInterface $entity) + protected function persist(EntityInterface $entity, bool $flush = true) { - $this->entityManager->persist($entity); + $this->entityManager->persist($entity, $flush); $entity->mergeNewTranslations(); - $this->flush(); + + if ($flush) { + $this->flush(); + } } }