Description
Hi,
first of all, thanks for the great work on the new filters, it's a great improvement, they are very nice and very powerful.
For the same property, sometimes I need to check if it is greater or lower than a specific value, and sometimes I need to check if it is strictly equal.
For example, for a date:
?foo[gt]=2026-01-01
- and in an other context:
?foo=2026-01-01
With the current way of declaring filters, I can't declare the same param with 2 different filters (here, ComparisonFilter and ExactFilter).
parameters: [
'foo' => new QueryParameter(
filter: new ExactFilter(),
),
'foo' => new QueryParameter( // <-- HERE: can't declare the same parameter twice, since it is an associative array, the second declaration will override the first one
filter: new ComparisonFilter(new ExactFilter()),
),
]
One solution could be to allow to pass an array to QueryParameter.filter (or to add a new filters property to QueryParameter)
Example
parameters: [
'foo' => new QueryParameter(
filter: [new ExactFilter(), new ComparisonFilter(new ExactFilter())],
),
]
It would be nice to have such a feature, because currently, as a workaround we need to alias the parameter name, which is a shame (to me, at least) for such a simple case.
parameters: [
'foo' => new QueryParameter(
filter: new ExactFilter(),
),
'fooCompare' => new QueryParameter(
filter: new ComparisonFilter(new ExactFilter()),
property: 'foo',
),
]
And if I need to use a third filter for the same property, it will force me to create a third alias, and so on...
An another, maybe, simpler (but more limited) solution, for my specific use case, would be to allow = as an operator for the ComparisonFilter.
Thanks in advance!
Description
Hi,
first of all, thanks for the great work on the new filters, it's a great improvement, they are very nice and very powerful.
For the same property, sometimes I need to check if it is greater or lower than a specific value, and sometimes I need to check if it is strictly equal.
For example, for a date:
?foo[gt]=2026-01-01?foo=2026-01-01With the current way of declaring filters, I can't declare the same param with 2 different filters (here,
ComparisonFilterandExactFilter).parameters: [ 'foo' => new QueryParameter( filter: new ExactFilter(), ), 'foo' => new QueryParameter( // <-- HERE: can't declare the same parameter twice, since it is an associative array, the second declaration will override the first one filter: new ComparisonFilter(new ExactFilter()), ), ]One solution could be to allow to pass an array to
QueryParameter.filter(or to add a newfiltersproperty toQueryParameter)Example
parameters: [ 'foo' => new QueryParameter( filter: [new ExactFilter(), new ComparisonFilter(new ExactFilter())], ), ]It would be nice to have such a feature, because currently, as a workaround we need to alias the parameter name, which is a shame (to me, at least) for such a simple case.
parameters: [ 'foo' => new QueryParameter( filter: new ExactFilter(), ), 'fooCompare' => new QueryParameter( filter: new ComparisonFilter(new ExactFilter()), property: 'foo', ), ]And if I need to use a third filter for the same property, it will force me to create a third alias, and so on...
An another, maybe, simpler (but more limited) solution, for my specific use case, would be to allow
=as an operator for theComparisonFilter.Thanks in advance!