Compare commits

..

13 commits

Author SHA1 Message Date
ac3781f01c
Merge branch 'develop' 2026-03-09 10:44:05 +01:00
173dc17a89
doc: update changelog 2026-03-09 10:44:00 +01:00
5ba5e93d14
fix(crud/template): use default route params 2026-03-09 10:43:51 +01:00
005dddcea2
Merge branch 'develop' 2026-02-21 23:03:30 +01:00
7fbbad9909
fix(crud/navigation_setting): fix form action 2026-02-21 23:03:20 +01:00
0fb486a383
Merge branch 'develop' 2025-12-23 09:50:13 +01:00
0fa748fd35
fix(crud/index): fix row attribute value render 2025-12-23 09:49:59 +01:00
8a780be0b0
Merge branch 'develop' 2025-12-22 19:32:04 +01:00
2e2b0bce10
feat(repository): add RepositoryQuery::addCaseInsensitiveFilters()
feat(repository): add RepositoryQuery::addForcedFilterHandler()
2025-12-22 19:32:01 +01:00
f17969db04
Merge branch 'develop' 2025-12-22 19:30:33 +01:00
14465d4982
feat(repository): add RepositoryQuery::addCaseInsensitiveFilters()
feat(repository): add RepositoryQuery::addForcedFilterHandler()
2025-12-22 19:30:29 +01:00
d3e0ba7ca5
Merge branch 'develop' 2025-12-22 19:23:47 +01:00
5a01d76883
feat(repository): add RepositoryQuery::addCaseInsensitiveFilters()
feat(repository): add RepositoryQuery::addForcedFilterHandler()
2025-12-22 19:23:39 +01:00
5 changed files with 33 additions and 5 deletions

View file

@ -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

View file

@ -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;
}
}

View file

@ -196,7 +196,7 @@
{% set rowAttributes = configuration.listRowAttributes(context, item) %}
{% set rowClasses = rowAttributes['class']|default('') %}
<tr {{ dataSortableItem|raw }} {% if configuration.doubleClick(context) %}data-dblclick="{{- dbClick -}}"{% endif %} class="{{ loop.index is odd ? 'is-odd' : 'is-even' }} {{ rowClasses }}" {% for attr, attrValue in rowAttributes %}{% if attr != 'class' %}{{ attr }}={{ attrValue }} {% endif %}{% endfor %}>
<tr {{ dataSortableItem|raw }} {% if configuration.doubleClick(context) %}data-dblclick="{{- dbClick -}}"{% endif %} class="{{ loop.index is odd ? 'is-odd' : 'is-even' }} {{ rowClasses }}" {% for attr, attrValue in rowAttributes %}{% if attr != 'class' %}{{ attr }}="{{ attrValue }}" {% endif %}{% endfor %}>
{% if configuration.hasBatchAction(context) %}
<td class="crud-batch-column">
<input type="checkbox" class="batch_form" name="batch[items][{{ loop.index }}]" form="form-batch" value="{{ loop.index }}">

View file

@ -18,7 +18,7 @@
{% block header_actions_before %}{% endblock %}
{% if configuration.action(context, 'back', true) %}
<a href="{{ path(configuration.pageRoute('index')) }}" class="btn btn-light">
<a href="{{ path(configuration.pageRoute('index'), configuration.pageRouteParams('index')) }}" class="btn btn-light">
<span class="fa fa-list pr-1"></span>
<span class="d-none d-md-inline">
{{ configuration.actionTitle(context, 'back', 'Back to the list')|trans }}
@ -27,7 +27,7 @@
{% endif %}
{% if configuration.action(context, 'edit', true, [entity]) %}
<a href="{{ path(configuration.pageRoute('edit'), {entity: entity.id}) }}" class="btn btn-primary">
<a href="{{ path(configuration.pageRoute('edit'), {entity: entity.id}|merge(configuration.pageRouteParams('edit'))) }}" class="btn btn-primary">
<span class="fa fa-edit pr-1"></span>
<span class="d-none d-md-inline">

View file

@ -13,7 +13,7 @@
</button>
</div>
<div class="modal-body">
<form action="{{ path('admin_setting_edit', {entity: entity.id, redirectTo: redirectTo}) }}" id="form-entity-edit" method="POST">
<form action="{{ path('admin_navigation_setting_edit', {entity: entity.id, redirectTo: redirectTo}) }}" id="form-entity-edit" method="POST">
{{ include('@Core/setting/navigation_setting_admin/_form.html.twig') }}
</form>
</div>