Skip to content

Proposition: using annotation for filters #1033

@pierre-H

Description

@pierre-H

Thank you again for your great work !

It would be easier to add a filter in the entity with annotations instead of adding a service.
For example :

<?php

// src/AppBundle/Entity/Offer.php

namespace AppBundle\Entity;

use ApiPlatform\Core\Annotation\ApiResource;
use ApiPlatform\Core\Annotation\ApiFilter;          // for example

/**
 * @ApiResource()
 */
class Offer
{
    /**
     * @ApiFilter('type="search_filter", precision="exact")
     */
    private $id;

    /**
     * @ApiFilter('type="date_filter")
     */
    private $date;

    ...
}

The goal here is to simplify the use of filters with Api-Platform, and I think it's important because the great success of Api-Platform is it's simplicity.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions