diff --git a/src/Controller/AliasController.php b/src/Controller/AliasController.php index 2366103d..1fe9dda8 100644 --- a/src/Controller/AliasController.php +++ b/src/Controller/AliasController.php @@ -20,10 +20,7 @@ class AliasController extends AbstractController public function __construct( private readonly AliasHandler $aliasHandler, private readonly EntityManagerInterface $manager, - ) - { - - } + ) {} #[Route(path: '/alias', name: 'aliases')] public function alias(Request $request): Response @@ -64,8 +61,8 @@ public function alias(Request $request): Response } $aliasRepository = $this->manager->getRepository(Alias::class); - $aliasesRandom = $aliasRepository->findByUser($user, true); - $aliasesCustom = $aliasRepository->findByUser($user, false); + $aliasesRandom = $aliasRepository->findByUser($user, true, true); + $aliasesCustom = $aliasRepository->findByUser($user, false, true); return $this->render( 'Start/aliases.html.twig', diff --git a/src/Repository/AliasRepository.php b/src/Repository/AliasRepository.php index a176010b..af9187ad 100644 --- a/src/Repository/AliasRepository.php +++ b/src/Repository/AliasRepository.php @@ -27,8 +27,14 @@ public function findOneBySource(string $email, ?bool $includeDeleted = false): ? * @param bool|null $random * @return array|Alias[] */ - public function findByUser(User $user, ?bool $random = null): array + public function findByUser(User $user, ?bool $random = null, ?bool $disableDomainFilter = false): array { + $filters = $this->getEntityManager()->getFilters(); + + if ($filters->isEnabled('domain_filter') && $disableDomainFilter == true) { + $filters->disable('domain_filter'); + } + if (isset($random)) { return $this->findBy(['user' => $user, 'random' => $random, 'deleted' => false]); }