Skip to content

Create complex filters with multiple properties #2

@bgaillard

Description

@bgaillard

The purpose of this case is to implement complex filters based on multiple properties. This could be provided with a special filter URL query parameter in a Web Service for example.

GET /products?enabled=true&filter=price:<90-validity:>=3

This will retrieve products havin a price lower than 80 OR a validity greater or equals to 3.

The : in an equals operator and prevents conflicts with the = operator used in the URL query parameters.

A sample call using the Gomoob Data Mapper / Service Layer standard conventions would be for example.

$this->productService->fetch(
    $offset,
    $pageSize,
    [
        'enabled' => true,
        0 => 'price:<90-validity:>=3'
    ]
);

Please note that we use integer key to differentiate simple property filters from complex property filters.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions