Skip to content

feat: support relations on filters#7711

Merged
soyuka merged 1 commit intoapi-platform:mainfrom
Maxcastel:feature/support-relations-on-filters
Feb 13, 2026
Merged

feat: support relations on filters#7711
soyuka merged 1 commit intoapi-platform:mainfrom
Maxcastel:feature/support-relations-on-filters

Conversation

@Maxcastel
Copy link
Contributor

@Maxcastel Maxcastel commented Jan 28, 2026

Q A
Branch? main
Tickets .
License MIT
Doc PR .

Description

This PR introduces support for relation traversal in the following filters:

  • PartialSearchFilter
  • ExactFilter
  • OrFilter
  • FreeTextQueryFilter

It allows filtering across nested associations.

Exemples

OneToMany relation filtering

Filter on a related entity property using property parameter:

new QueryParameter(
    filter: new PartialSearchFilter(),
    property: 'chickens.name',
),

Multi-level relation traversal

Filter on deeply nested properties:

new QueryParameter(
    filter: new PartialSearchFilter(),
    property: 'chickens.owner.name',
),

Multiple properties with placeholder

Filter using the :property placeholder:

'search[:property]' => new QueryParameter(
    filter: new PartialSearchFilter(),
    properties: ['chickens.name', 'chickens.ean'],
),

@Maxcastel Maxcastel marked this pull request as draft January 28, 2026 11:33
@Maxcastel Maxcastel force-pushed the feature/support-relations-on-filters branch from 056fa57 to fffaa15 Compare January 30, 2026 14:29
@alexislefebvre
Copy link
Contributor

alexislefebvre commented Feb 5, 2026

Does it address #7610?

Update: no, both subjects are about Filters but #7610 is not about relations / joins.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could you move this to a trait? we're using this everywhere

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will do a refactor commit

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done in 5798e25

@Maxcastel Maxcastel force-pushed the feature/support-relations-on-filters branch from 2a6baed to 490a9af Compare February 11, 2026 10:09
@Maxcastel Maxcastel force-pushed the feature/support-relations-on-filters branch from b687156 to 30649af Compare February 11, 2026 15:31
@Maxcastel Maxcastel marked this pull request as ready for review February 11, 2026 15:54
@Maxcastel Maxcastel requested a review from soyuka February 11, 2026 15:54
@soyuka soyuka force-pushed the feature/support-relations-on-filters branch 7 times, most recently from d7a1a2f to 4a202ba Compare February 13, 2026 15:39
@soyuka soyuka force-pushed the feature/support-relations-on-filters branch from 4a202ba to 2ba4ff4 Compare February 13, 2026 16:07
@soyuka soyuka merged commit 32e9484 into api-platform:main Feb 13, 2026
2 checks passed
@tjveldhuizen
Copy link

@Maxcastel The PR description mentions IriFilter, but it looks like this feature is not implemented for that filter. Is it on purpose? It also mentions OrFilter, but I have not used that, so I can't reason if it works/should work or not.

@soyuka
Copy link
Member

soyuka commented Feb 14, 2026

We'll handle IriFilter in another patch.

soyuka added a commit to soyuka/core that referenced this pull request Feb 14, 2026
| Q             | A
| ------------- | ---
| Branch?       | main
| Tickets       | Related to api-platform#7711
| License       | MIT
| Doc PR        | ∅

* Migrate IriFilter to use NestedPropertyHelperTrait for nested properties
* Migrate AbstractUuidFilter from OrmPropertyHelperTrait to NestedPropertyHelperTrait
* Add comprehensive tests for nested filtering with both filters
soyuka added a commit to soyuka/core that referenced this pull request Feb 14, 2026
| Q             | A
| ------------- | ---
| Branch?       | main
| Tickets       | Related to api-platform#7711
| License       | MIT
| Doc PR        | ∅

* Migrate IriFilter to use NestedPropertyHelperTrait for nested properties
* Migrate AbstractUuidFilter from OrmPropertyHelperTrait to NestedPropertyHelperTrait
* Add comprehensive tests for nested filtering with both filters

  # Please enter the commit message for your changes. Lines starting
  # with '#' will be ignored, and an empty message aborts the commit.
  #
  # On branch iri-filter-relation
  # Changes to be committed:
  #	modified:   src/Doctrine/Orm/Filter/AbstractUuidFilter.php
  #	modified:   src/Doctrine/Orm/Filter/IriFilter.php
  #	new file:   tests/Fixtures/TestBundle/Entity/FilterNestedTest/Company.php
  #	new file:   tests/Fixtures/TestBundle/Entity/FilterNestedTest/Department.php
  #	new file:   tests/Fixtures/TestBundle/Entity/FilterNestedTest/Employee.php
  #	new file:   tests/Functional/NestedFilterTest.php
@Maxcastel
Copy link
Contributor Author

I updated description @tjveldhuizen.
OrFilter is used with another filter.

soyuka added a commit to soyuka/core that referenced this pull request Feb 16, 2026
| Q             | A
| ------------- | ---
| Branch?       | main
| Tickets       | Related to api-platform#7711
| License       | MIT
| Doc PR        | ∅

* Migrate IriFilter to use NestedPropertyHelperTrait for nested properties
* Migrate AbstractUuidFilter from OrmPropertyHelperTrait to NestedPropertyHelperTrait
* Add comprehensive tests for nested filtering with both filters

  # Please enter the commit message for your changes. Lines starting
  # with '#' will be ignored, and an empty message aborts the commit.
  #
  # On branch iri-filter-relation
  # Changes to be committed:
  #	modified:   src/Doctrine/Orm/Filter/AbstractUuidFilter.php
  #	modified:   src/Doctrine/Orm/Filter/IriFilter.php
  #	new file:   tests/Fixtures/TestBundle/Entity/FilterNestedTest/Company.php
  #	new file:   tests/Fixtures/TestBundle/Entity/FilterNestedTest/Department.php
  #	new file:   tests/Fixtures/TestBundle/Entity/FilterNestedTest/Employee.php
  #	new file:   tests/Functional/NestedFilterTest.php
soyuka added a commit to soyuka/core that referenced this pull request Feb 16, 2026
| Q             | A
| ------------- | ---
| Branch?       | main
| Tickets       | Related to api-platform#7711
| License       | MIT
| Doc PR        | ∅

* Migrate IriFilter to use NestedPropertyHelperTrait for nested properties
* Migrate AbstractUuidFilter from OrmPropertyHelperTrait to NestedPropertyHelperTrait
* Add comprehensive tests for nested filtering with both filters

  # Please enter the commit message for your changes. Lines starting
  # with '#' will be ignored, and an empty message aborts the commit.
  #
  # On branch iri-filter-relation
  # Changes to be committed:
  #	modified:   src/Doctrine/Orm/Filter/AbstractUuidFilter.php
  #	modified:   src/Doctrine/Orm/Filter/IriFilter.php
  #	new file:   tests/Fixtures/TestBundle/Entity/FilterNestedTest/Company.php
  #	new file:   tests/Fixtures/TestBundle/Entity/FilterNestedTest/Department.php
  #	new file:   tests/Fixtures/TestBundle/Entity/FilterNestedTest/Employee.php
  #	new file:   tests/Functional/NestedFilterTest.php
soyuka added a commit to soyuka/core that referenced this pull request Feb 16, 2026
| Q             | A
| ------------- | ---
| Branch?       | main
| Tickets       | Related to api-platform#7711
| License       | MIT
| Doc PR        | ∅

* Migrate IriFilter to use NestedPropertyHelperTrait for nested properties
* Migrate AbstractUuidFilter from OrmPropertyHelperTrait to NestedPropertyHelperTrait
* Add comprehensive tests for nested filtering with both filters

  # Please enter the commit message for your changes. Lines starting
  # with '#' will be ignored, and an empty message aborts the commit.
  #
  # On branch iri-filter-relation
  # Changes to be committed:
  #	modified:   src/Doctrine/Orm/Filter/AbstractUuidFilter.php
  #	modified:   src/Doctrine/Orm/Filter/IriFilter.php
  #	new file:   tests/Fixtures/TestBundle/Entity/FilterNestedTest/Company.php
  #	new file:   tests/Fixtures/TestBundle/Entity/FilterNestedTest/Department.php
  #	new file:   tests/Fixtures/TestBundle/Entity/FilterNestedTest/Employee.php
  #	new file:   tests/Functional/NestedFilterTest.php
soyuka added a commit to soyuka/core that referenced this pull request Feb 16, 2026
| Q             | A
| ------------- | ---
| Branch?       | main
| Tickets       | Related to api-platform#7711
| License       | MIT
| Doc PR        | ∅

* Migrate IriFilter to use NestedPropertyHelperTrait for nested properties
* Migrate AbstractUuidFilter from OrmPropertyHelperTrait to NestedPropertyHelperTrait
* Add comprehensive tests for nested filtering with both filters

  # Please enter the commit message for your changes. Lines starting
  # with '#' will be ignored, and an empty message aborts the commit.
  #
  # On branch iri-filter-relation
  # Changes to be committed:
  #	modified:   src/Doctrine/Orm/Filter/AbstractUuidFilter.php
  #	modified:   src/Doctrine/Orm/Filter/IriFilter.php
  #	new file:   tests/Fixtures/TestBundle/Entity/FilterNestedTest/Company.php
  #	new file:   tests/Fixtures/TestBundle/Entity/FilterNestedTest/Department.php
  #	new file:   tests/Fixtures/TestBundle/Entity/FilterNestedTest/Employee.php
  #	new file:   tests/Functional/NestedFilterTest.php
soyuka added a commit to soyuka/core that referenced this pull request Feb 16, 2026
| Q             | A
| ------------- | ---
| Branch?       | main
| Tickets       | Related to api-platform#7711
| License       | MIT
| Doc PR        | ∅

* Migrate IriFilter to use NestedPropertyHelperTrait for nested properties
* Migrate AbstractUuidFilter from OrmPropertyHelperTrait to NestedPropertyHelperTrait
* Add comprehensive tests for nested filtering with both filters

  # Please enter the commit message for your changes. Lines starting
  # with '#' will be ignored, and an empty message aborts the commit.
  #
  # On branch iri-filter-relation
  # Changes to be committed:
  #	modified:   src/Doctrine/Orm/Filter/AbstractUuidFilter.php
  #	modified:   src/Doctrine/Orm/Filter/IriFilter.php
  #	new file:   tests/Fixtures/TestBundle/Entity/FilterNestedTest/Company.php
  #	new file:   tests/Fixtures/TestBundle/Entity/FilterNestedTest/Department.php
  #	new file:   tests/Fixtures/TestBundle/Entity/FilterNestedTest/Employee.php
  #	new file:   tests/Functional/NestedFilterTest.php
soyuka added a commit to soyuka/core that referenced this pull request Feb 17, 2026
| Q             | A
| ------------- | ---
| Branch?       | main
| Tickets       | Related to api-platform#7711
| License       | MIT
| Doc PR        | ∅

* Migrate IriFilter to use NestedPropertyHelperTrait for nested properties
* Migrate AbstractUuidFilter from OrmPropertyHelperTrait to NestedPropertyHelperTrait
* Add comprehensive tests for nested filtering with both filters

  # Please enter the commit message for your changes. Lines starting
  # with '#' will be ignored, and an empty message aborts the commit.
  #
  # On branch iri-filter-relation
  # Changes to be committed:
  #	modified:   src/Doctrine/Orm/Filter/AbstractUuidFilter.php
  #	modified:   src/Doctrine/Orm/Filter/IriFilter.php
  #	new file:   tests/Fixtures/TestBundle/Entity/FilterNestedTest/Company.php
  #	new file:   tests/Fixtures/TestBundle/Entity/FilterNestedTest/Department.php
  #	new file:   tests/Fixtures/TestBundle/Entity/FilterNestedTest/Employee.php
  #	new file:   tests/Functional/NestedFilterTest.php
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.

4 participants

Comments