Skip to content

fix(doctrine): left join nested props in OrFilter - #8674

Merged
soyuka merged 1 commit into
api-platform:4.4from
soyuka:fix/orfilter-nullable-join-8655
Oct 12, 2026
Merged

soyuka merged 1 commit into
api-platform:4.4from
soyuka:fix/orfilter-nullable-join-8655

Conversation

@soyuka

@soyuka soyuka commented Oct 12, 2026

Copy link
Copy Markdown
Member
Q A
Branch? 4.4
Tickets Fixes #8655
License MIT
Doc PR

Nested properties searched through FreeTextQueryFilter(new OrFilter(...)) used an INNER JOIN (ORM) or an $unwind without preserveNullAndEmptyArrays (ODM). Root rows with a null relation were dropped before the OR ran, even when a scalar property matched.

Under OR, ORM nested filters now LEFT JOIN and ODM nested filters keep the nulls. Plain AND is unchanged, a unit test pins the INNER JOIN there. The functional test also runs on MongoDB, it's the first run of the ODM path as I couldn't install ODM locally.

Note: if an AND filter already added an INNER JOIN on the same relation it's reused, results don't change as the AND filter requires the relation anyway.

@soyuka
soyuka merged commit 3e04ee3 into api-platform:4.4 Oct 12, 2026
116 of 117 checks passed
soyuka added a commit that referenced this pull request Nov 4, 2026
…OR groups (#8777)

* fix(doctrine): left join collection associations in IriFilter inside OR groups

When an IriFilter on a collection association (e.g. `tags`) is grouped with
other conditions in an OrFilter, it always added an INNER JOIN, so rows
matching only the other branches but having an empty collection were dropped.
It now uses the same join type helper as the nested property joins (#8674).

* refactor(doctrine): drop IriFilter join comment

---------

Co-authored-by: soyuka <[email protected]>
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