From ba00c473300d012a1a14ceeb00467b6d1cfb3040 Mon Sep 17 00:00:00 2001 From: Sergio Mendolia Date: Sat, 23 Sep 2023 11:13:18 +0200 Subject: [PATCH] fix filtering --- src/Form/BookFilterType.php | 2 +- src/Service/FilteredBookUrlGenerator.php | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Form/BookFilterType.php b/src/Form/BookFilterType.php index eece238e..0b3ffd34 100644 --- a/src/Form/BookFilterType.php +++ b/src/Form/BookFilterType.php @@ -219,7 +219,7 @@ public function buildForm(FormBuilderInterface $builder, array $options): void 'mapped' => false, 'target_callback' => function (QueryBuilder $qb, ?string $readValue): void { - if ($readValue !== null) { + if ($readValue !== null && $readValue !== '') { $qb->andWhere($qb->expr()->like('book.extension', ':extension')); $qb->setParameter('extension', $readValue); } diff --git a/src/Service/FilteredBookUrlGenerator.php b/src/Service/FilteredBookUrlGenerator.php index ecc868df..51876e5f 100644 --- a/src/Service/FilteredBookUrlGenerator.php +++ b/src/Service/FilteredBookUrlGenerator.php @@ -18,6 +18,7 @@ class FilteredBookUrlGenerator 'read' => '', 'picture' => '', 'favorite' => '', + 'extension' => '', 'verified' => '', 'orderBy' => '', 'submit' => '',