Skip to content

feat(doctrine): add StartSearchFilter and WordStartSearchFilter (ORM + ODM)#8328

Merged
soyuka merged 1 commit into
api-platform:mainfrom
soyuka:feat/doctrine-start-wordstart-search-filters
Jun 17, 2026
Merged

feat(doctrine): add StartSearchFilter and WordStartSearchFilter (ORM + ODM)#8328
soyuka merged 1 commit into
api-platform:mainfrom
soyuka:feat/doctrine-start-wordstart-search-filters

Conversation

@soyuka

@soyuka soyuka commented Jun 17, 2026

Copy link
Copy Markdown
Member

What

Two new primary Doctrine search filters for 4.4, completing the canonical search family alongside the recently merged EndSearchFilter (#8319) and PartialSearchFilter:

  • StartSearchFilter — prefix match. ORM LIKE 'value%', ODM /^value/.
  • WordStartSearchFilter — word-boundary prefix. ORM LIKE 'value%' OR LIKE '% value%', ODM /(^value|\svalue)/, matching the legacy SearchFilter word_start strategy.

How

All four classes (ORM + ODM × 2) mirror EndSearchFilter exactly: final class … implements FilterInterface, OpenApiParameterFilterInterface, same three traits (BackwardCompatibleFilterDescriptionTrait, NestedPropertyHelperTrait/ODM equivalent, OpenApiFilterTrait), same bool $caseSensitive ctor default (ORM false, ODM true), same scalar/iterable branching and ESCAPE '\' LIKE construction. Values escaped via addcslashes($value, '\\%_').

These are new primary filters: not @experimental, not @deprecated — the recommended way going forward.

BC

Purely additive (4 new filter classes + 2 functional tests + Chicken fixture wiring). Zero BC break.

Tests

New functional tests under tests/Functional/Parameters/ for both filters, ORM + ODM, wired into the Chicken fixture (nameStart, nameStartSensitive, nameWordStart, plus no-property variants). ORM suites green locally; ODM exercised in CI (no local mongod).

Part of the 4.4 filter refactor (ship replacement primaries before deprecating legacy counterparts).

…+ ODM)

Ports the LIKE 'value%' prefix search and the word-boundary prefix search
to the canonical Doctrine filter family for 4.4, mirroring EndSearchFilter.

StartSearchFilter matches strings starting with the value (ORM LIKE 'value%',
ODM /^value/). WordStartSearchFilter matches any word starting with the value
(ORM LIKE 'value%' OR '% value%', ODM /(^value|\svalue)/), with parity to the
legacy SearchFilter word_start strategy.

Both are new primary filters: not experimental, not deprecated. Additive,
zero BC break.
@soyuka soyuka merged commit 4bf850f into api-platform:main Jun 17, 2026
86 of 96 checks passed
@soyuka soyuka deleted the feat/doctrine-start-wordstart-search-filters branch June 17, 2026 18:20
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