diff --git a/CHANGELOG.md b/CHANGELOG.md index 9e5def0..7761553 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,14 @@ ## [Unreleased] +### Added +* feat(repository): add RepositoryQuery::addCaseInsensitiveFilters() +* feat(repository): add RepositoryQuery::addForcedFilterHandler() + +### Fixed +* fix(crud/index): fix row attribute value render +* fix(crud/navigation_setting): fix form action +* fix(crud/template): use default route params + ## [v1.27.0] - 2025-12-22 ### Fixed * fix(crud): use route params to redirect after a delation diff --git a/src/core/Repository/RepositoryQuery.php b/src/core/Repository/RepositoryQuery.php index 904c965..e2943b0 100644 --- a/src/core/Repository/RepositoryQuery.php +++ b/src/core/Repository/RepositoryQuery.php @@ -18,6 +18,7 @@ abstract class RepositoryQuery protected PaginatorInterface $paginator; protected string $id; protected array $forcedFilterHandlers = []; + protected array $caseInsensitiveFilters = []; public function __construct(ServiceEntityRepository $repository, string $id, PaginatorInterface $paginator = null) { @@ -88,7 +89,11 @@ abstract class RepositoryQuery $this->andWhere('.'.$name.' = :'.$name); $this->setParameter(':'.$name, $value); } elseif (is_string($value)) { - $this->andWhere('.'.$name.' LIKE :'.$name); + if (in_array($name, $this->caseInsensitiveFilters)) { + $this->andWhere(sprintf('LOWER ( .%1$s) LIKE LOWER(:%1$s)', $name)); + } else { + $this->andWhere('.'.$name.' LIKE :'.$name); + } $this->setParameter(':'.$name, '%'.$value.'%'); } else { $this->filterHandler($name, $value); @@ -142,4 +147,18 @@ abstract class RepositoryQuery protected function filterHandler(string $name, $value) { } + + protected function addCaseInsensitiveFilters(string $name): self + { + $this->caseInsensitiveFilters[] = $name; + + return $this; + } + + protected function addForcedFilterHandlers(string $name): self + { + $this->forcedFilterHandlers[] = $name; + + return $this; + } } diff --git a/src/core/Resources/views/admin/crud/index.html.twig b/src/core/Resources/views/admin/crud/index.html.twig index fa5dcda..ae40134 100644 --- a/src/core/Resources/views/admin/crud/index.html.twig +++ b/src/core/Resources/views/admin/crud/index.html.twig @@ -196,7 +196,7 @@ {% set rowAttributes = configuration.listRowAttributes(context, item) %} {% set rowClasses = rowAttributes['class']|default('') %} - + {% if configuration.hasBatchAction(context) %} diff --git a/src/core/Resources/views/admin/crud/show.html.twig b/src/core/Resources/views/admin/crud/show.html.twig index 2cefa56..d98dd22 100644 --- a/src/core/Resources/views/admin/crud/show.html.twig +++ b/src/core/Resources/views/admin/crud/show.html.twig @@ -18,7 +18,7 @@ {% block header_actions_before %}{% endblock %} {% if configuration.action(context, 'back', true) %} - + {{ configuration.actionTitle(context, 'back', 'Back to the list')|trans }} @@ -27,7 +27,7 @@ {% endif %} {% if configuration.action(context, 'edit', true, [entity]) %} - + diff --git a/src/core/Resources/views/setting/navigation_setting_admin/edit.html.twig b/src/core/Resources/views/setting/navigation_setting_admin/edit.html.twig index 52a9aff..e1488ef 100644 --- a/src/core/Resources/views/setting/navigation_setting_admin/edit.html.twig +++ b/src/core/Resources/views/setting/navigation_setting_admin/edit.html.twig @@ -13,7 +13,7 @@