API Filter
Filter
TBD: Example in Domain Action
Filter Params
To use the filter params feature, your desired filter property needs to implement the HeadlessBundle\Filter\FilterParamsInterface.
Example
## a classy filter class which introduces a filter param property
namespace App\Filter;
class SpecialFilter extends AbstractFilter
{
public ProductFilter $filter;
}
## and the corresponding filter params aware DTO
namespace App\Dto;
class ProductFilter implements FilterParamsInterface
{
#[OA\Property(
type: 'array',
items: new OA\Items(
properties: [
new OA\Property(property: 'id', type: 'integer')
],
type: 'object',
uniqueItems: true
),
example: [
'1' => '50',
'2' => '51',
]
)]
public array $category;
public int $manufacturer;
}
Form Request Output:
filter[category][1]=50&filter[category][2]=51&filter[manufacturer]=0'