Skip to content

Add alias to filter properties #5856

@tjveldhuizen

Description

@tjveldhuizen

Description
API Platform allows to define filters based on properties in a related object. For example: /teams?club.slug=my-club. I don't like the fact that my internal properties need to be exposed in this filters. Maybe it's not that problematic in this case, but when filtering on objects 'further away' it can get messy: /matches?pool.competition.season.id=2023&pool.competition.region.slug=north and I'm exposing more of the data model. It would be really nice to be able to squash that into /matches?season=2023&region=north.

Now, the only solution is to create custom filters, but it might be possible to allow adding an alias to the #[ApiFilter] attribute? However the fact that multiple properties are allowed makes the format of such configuration complicated.

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