Skip to content

docs: DateFilter has no ComparisonFilter replacement; document ChainFilter#2316

Open
soyuka wants to merge 1 commit into
api-platform:mainfrom
soyuka:fix/datefilter-no-comparison-replacement
Open

docs: DateFilter has no ComparisonFilter replacement; document ChainFilter#2316
soyuka wants to merge 1 commit into
api-platform:mainfrom
soyuka:fix/datefilter-no-comparison-replacement

Conversation

@soyuka

@soyuka soyuka commented Jul 26, 2026

Copy link
Copy Markdown
Member

What

Corrects filter-migration guidance and documents the new ChainFilter.

  1. DateFilter has no modern replacement. The docs suggested replacing DateFilter with ComparisonFilter(new ExactFilter()). That's wrong — ComparisonFilter only does plain gt/gte/lt/lte/ne comparisons and does not replicate DateFilter's per-property null management, \DateTime/\DateTimeImmutable binding from the Doctrine column type, tolerant invalid/empty-value handling, or the inclusive before/after vs exclusive strictly_* vocabulary. Rewrote the Date Filter tip, the "Built-in Search Filters" list entry, and a misleading createdAt/Event ODM example. (RangeFilter→ComparisonFilter advice is left intact — correct for numeric ranges.)

  2. #7361 warmup ALERT note. Wherever a legacy AbstractFilter-based filter (DateFilter, RangeFilter, ExistsFilter) is shown declared inline (new DateFilter()) in a QueryParameter, added a [!NOTE]: it logs a cosmetic ManagerRegistry must be initialized before accessing it. ALERT at cache warmup (filtering still works); silence it via a service id or a ChainFilter.

  3. New ## Chain Filter section. Documents the 4.4 ChainFilter (ORM + ODM) — composes several filters on one key, each self-selecting by value shape; canonical ExactFilter + DateFilter example that keeps DateFilter's semantics and suppresses the #7361 ALERT.

  4. Boolean recipe updated for castToArray: false (single param) — consistent with the OpenAPI parameter fix in core.

Pairs with

  • core #8416 (ChainFilter, ORM + ODM) — this documents it. Should merge together / after.
  • Relates to core #7361, #8407, #8406.

markdownlint clean on both changed files.

…ilter

Correct the guidance suggesting ComparisonFilter replaces DateFilter —
ComparisonFilter does not replicate DateFilter's null management, Doctrine
date-type binding, tolerant invalid-value handling, or inclusive/exclusive
before/after vocabulary. DateFilter is a kept filter with no modern equivalent.

Add a #7361 note wherever a legacy AbstractFilter (DateFilter/RangeFilter/
ExistsFilter) is shown inline in a QueryParameter: the cosmetic ManagerRegistry
warmup ALERT, silenced via a service id or a ChainFilter.

Document the new 4.4 ChainFilter (ORM + ODM) for composing several filters on a
single parameter key, and update the boolean ExactFilter recipe for castToArray.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant