Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Facilitate usage of filters #46

Open
mcsky opened this issue Nov 4, 2019 · 1 comment
Open

Facilitate usage of filters #46

mcsky opened this issue Nov 4, 2019 · 1 comment
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@mcsky
Copy link
Contributor

mcsky commented Nov 4, 2019

The filters are used to filtering a collection of items.

It is common to want a filter applying only for a specific route.

Unfortunately, the method (supports(string $class)) doesn't have the request. To implement this logic you have to inject the requestStack and do the classic checks against null value.

It could be helpful and have sense to inject the current request to the support method (and only support)

This is BC IMHO, but what do you think @Nek- ?

@mcsky mcsky added enhancement New feature or request good first issue Good for newcomers labels Nov 4, 2019
@Nek-
Copy link
Contributor

Nek- commented Nov 7, 2019

I'm not sure it's a good idea to match directly on the request stack in case you want a route-related filter.

Here is an idea of implementation that keep BC. What do you think about adding a RouteAwareFilterInterface with a trait like this:

trait RouteAwareTrait
{
    private $route;
    public function setRoute(string $route) { $this->route = $route; }
}

But another idea (potentially better) is to add a new parameter extra_filters to the route we define. WDYT?

Nek- added a commit to Nek-/Melodiia that referenced this issue Nov 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants