2022-03-13 19:32:32 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Core\Manager;
|
|
|
|
|
|
|
|
use App\Core\Entity\EntityInterface;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* class TranslatableEntityManager.
|
|
|
|
*
|
|
|
|
* @author Simon Vieille <simon@deblan.fr>
|
|
|
|
*/
|
|
|
|
class TranslatableEntityManager extends EntityManager
|
|
|
|
{
|
2023-09-28 10:32:49 +02:00
|
|
|
protected function persist(EntityInterface $entity, bool $flush = true)
|
2022-03-13 19:32:32 +01:00
|
|
|
{
|
2023-09-28 10:32:49 +02:00
|
|
|
$this->entityManager->persist($entity, $flush);
|
2022-03-13 19:32:32 +01:00
|
|
|
$entity->mergeNewTranslations();
|
2023-09-28 10:32:49 +02:00
|
|
|
|
|
|
|
if ($flush) {
|
|
|
|
$this->flush();
|
|
|
|
}
|
2022-03-13 19:32:32 +01:00
|
|
|
}
|
|
|
|
}
|