Skip to content

Built-in OR Filter #2014

@Mareva-dev

Description

@Mareva-dev

Hello,

I just wanted to know if you planned to add a built-in filter which allows us to apply all query parameters using the OR logic. I saw a lot of custom filters out there but nothing really up to date or well documented.

//...
 * @ApiFilter(RangeFilter::class, properties={"productOptions.capacity"})
 * @ApiFilter(OrFilter::class, properties={"productOptions.capacity"})
//...

For example.

Moreover,

The following request works well:
https://127.0.0.1:8000/api/products?productOptions.capacity[gt]=10&productOptions.capacity[lt]=20

This one as well:
https://127.0.0.1:8000/api/products?productOptions.capacity[between]=400..500

But this one is not working at all:
https://127.0.0.1:8000/api/products?productOptions.capacity[between]=10..20
It returns all results (filter is not applied).

is range filter [Between] broken ?

Here is how i declare it :

/**
 * Product.php
 * ...
 * @ApiFilter(SearchFilter::class, properties={"brand", "categories", "type", "productOptions.poolType", "productOptions.packaging"})
 * @ApiFilter(RangeFilter::class, properties={"productOptions.capacity"})
 */



   /**
     * ProductOptions.php
     * ...
     * @ORM\Column(type="float", nullable=true)
     * @Groups({"product_options_read", "product_options_write", "products_read", "products_write"})
     */
    private $capacity;

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions