fix compatibility of TranslatableEntityManager with the entity manager

This commit is contained in:
Simon Vieille 2023-09-28 10:32:49 +02:00
parent 7fceefa6d3
commit 28a4f63640
Signed by: deblan
GPG key ID: 579388D585F70417

View file

@ -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();
}
}
}