Skip to content

Allow applying filters on relations #7600

@Coffee2CodeNL

Description

@Coffee2CodeNL

Description
Add some native and easy to use way to allow to filter on relations of a resource, for instance applying filters on a Category resource with a OneToMany relationship to a Product resource, and only returning the products matching that filter.

Example
Something along the lines of

search[products.name]="egg"

Which would be defined as

'search[:property]'      => new QueryParameter(
    openApi: new Parameter(
        name: 'search[:property][]',
        in: 'query',
        description: 'A fuzzy filter<br />Fields: `name`, `description`'
    ),
    filter: new PartialSearchFilter(),
    properties: ['name', 'description']
),

Which would return a subset of Products on the Category resource matching the filter:

{
  "@context": "/contexts/Category",
  "@id": "/categories/12",
  "@type": "Category",
  "name": "Category Name",
  "products": [
    "/products/1",
    "/products/5",
    "/products/7"
   ]
}

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