Commit 1fe9362e by Julien Jorry

Fix enabled_filter problems

parent a7df490e
......@@ -121,7 +121,9 @@ class FormFactory
$presta = $this->session->get('_prestagere');
$presta = $this->em->merge($presta);
// Disable enabled_filter to display all adresses
$this->em->getFilters()->disable('enabled_filter');
if ($this->em->getFilters()->isEnabled('enabled_filter')) {
$this->em->getFilters()->disable('enabled_filter');
}
$form = $this->ff->create(PrestataireInfosFormType::class, $presta, ['action' => $this->router->generate('prestataire_infos')]);
return $form->createView();
......
......@@ -50,8 +50,9 @@ class Configurator
// @TODO : sur le backoffice, mettre un bouton pour afficher les éléments supprimés
// (pas vraiment, avec le filtre softdelete) et une variable en session pour activer ou non le filtrer Doctrine
// $this->em->getFilters()->disable('softdeleteable');
$this->em->getFilters()->disable('enabled_filter');
if ($this->em->getFilters()->isEnabled('enabled_filter')) {
$this->em->getFilters()->disable('enabled_filter');
}
}
}
}
......@@ -43,8 +43,8 @@ class PrestataireRepository extends ServiceEntityRepository
public function getPrestataireMLC()
{
if ($this->_em->getFilters()->isEnabled('enabled_filter')) {
$this->_em->getFilters()->disable('enabled_filter');
if ($this->getEntityManager()->getFilters()->isEnabled('enabled_filter')) {
$this->getEntityManager()->getFilters()->disable('enabled_filter');
}
$qb = $this->createQueryBuilder('p');
$result = $qb
......@@ -54,7 +54,9 @@ class PrestataireRepository extends ServiceEntityRepository
->getQuery()
->getOneOrNullResult()
;
// $this->_em->getFilters()->enable('enabled_filter');
if (!$this->getEntityManager()->getFilters()->isEnabled('enabled_filter')) {
$this->getEntityManager()->getFilters()->enable('enabled_filter');
}
return $result;
}
......
......@@ -108,7 +108,6 @@ class AppExtension extends AbstractExtension
public function getMLCPrestataire(): ?Prestataire
{
try {
// $this->em->getFilters()->enable('enabled_filter');
$prestaMLC = $this->em->getRepository(Prestataire::class)->getPrestataireMLC();
return $prestaMLC;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment