Uh oh!
There was an error while loading. Please reload this page.
docs(filters): document enhanced QueryParameter syntax on old filters - #2227
Conversation
1409cd7 to
4340fdaComparettskch
commented
Nov 5, 2025
Thank you for improving the documentation. Please allow me to share my insights. In v4.2.3, when setting filters using - parameters: [- 'search[:property]' => new QueryParameter(/* ... */)+ parameters: [+ new QueryParameter(key: 'search[:property]', /* ... */)Also, directly passing a filter instance to the For example, I have observed the following issues in my environment.
newQueryParameter(key: 'exists[content]', filter: newExistsFilter(), property: 'content'),
newQueryParameter(key: 'exists[comments]', filter: newExistsFilter(), property: 'comments'),
newQueryParameter(key: 'order[id]', filter: newOrderFilter(), property: 'id'),
newQueryParameter(key: 'order[date]', filter: newOrderFilter(), property: 'date'), |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
aegypius
left a comment
There was a problem hiding this comment.
polish: I made a bunch of suggestions regarding spelling.
soyuka
commented
Dec 4, 2025
About the other issues we refactored the code for the |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
… usage - Updated documentation to promote the `QueryParameter` attribute over `ApiFilter`, as the latter is deprecated and scheduled for removal in API Platform 5.0. - Added examples for Date, Boolean, Numeric, Range, Exists, and Order filters using the `QueryParameter` approach. Included notes on configuring custom strategies, handling null values, and enabling filters for nested properties.
Co-authored-by: Nicolas LAURENT <aegypius@users.noreply.github.com>
34bec11 to
557c93eComparesoyuka
commented
Dec 5, 2025
Many thanks for the work on this! I'll fix linting issues in another PR! |
Uh oh!
There was an error while loading. Please reload this page.
ttskch
commented
Dec 29, 2025
Thank you for the detailed explanation. I finally understand the conditions for reproduction. I declare parameters as follows in the #[ORM\Entity(repositoryClass: ArticleRepository::class)]
class Article
{
// ...publicstaticfunctionapiResource(): array
{
return [
newGetCollection(
parameters: [
newQueryParameter(filter: newDateFilter(), key: ':property', properties: ['date']),
],
),
];
}
}If we declare it as follows using class attributes, the output will be correct. #[GetCollection(
parameters: [
newQueryParameter(filter: newDateFilter(), key: ':property', properties: ['date']),
],
)]
#[ORM\Entity(repositoryClass: ArticleRepository::class)]
class Article
{
// ...
}Incidentally, even if we declare it as follows using a PHP resource file, OpenAPI/Hydra still does not output correctly. <?phpuseApiPlatform\Doctrine\Orm\Filter\DateFilter;
useApiPlatform\Metadata\ApiResource;
useApiPlatform\Metadata\GetCollection;
useApiPlatform\Metadata\Operations;
useApiPlatform\Metadata\QueryParameter;
useApp\Entity\Article;
return (newApiResource())
->withClass(Article::class)
->withOperations(newOperations([
newGetCollection(
parameters: [
newQueryParameter(filter: newDateFilter(), key: ':property', properties: ['date']),
],
),
]))
;Do you know what the cause is? |
ttskch
commented
Jan 7, 2026
@soyuka At api-platform/core#7654 and api-platform/core#7655, I have exhaustively summarized the filter-related bugs I'm aware of in the Issues. Apologies for the trouble, but please check them. |
Completes #2203
And here to avoid these issues:
QueryParameter, it is not possible to set multiple filters for the same property core#7493:propertykey cannot be used inSearchFilter(Symfony only) core#7495Main changes:
QueryParameterapproach. Included notes on configuring custom strategies, handling null values, and enabling filters for nested properties.QueryParameterattribute overApiFilter, as the latter is deprecated and scheduled for removal in API Platform 5.0.