question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Feature Request] Apply filters only on specific operations

See original GitHub issue

Hello, I want to apply a NumericFilter for a customerId property, and I want that filter to only be available to the collection operation for admins (I have one collection operation that gets all the orders for the current customer and another for admins that can retrieve all orders). This is currently not possible without a custom filter, even though the filterProperty function from the NumericFilter class has the $operationName as an argument. And even after creating the custom filter, I also have to override the getDescription function since that function does not have the operation as an argument so I can not generate swagger documentation for only a specific operation.

I do not know why this is not possible by default, it seems to me that this is a very useful feature. Thank you.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
raress96commented, Dec 19, 2019

@d0niek So that works?Then I am guessing that this was implemented at some point then. Haven’t had the time to test it myself yet but will take a look.

2reactions
d0niekcommented, Dec 18, 2019

I put filters under operations like here:

   * @ApiResource(
   *   collectionOperations={
   *     "get"={
   *       "filters"={
   *         Filter\Search::class,
   *         Filter\Customer::class
   *       }
   *     },
   *     "for_contact_person"={
   *       "controller"=ContactPersonController\Customers::class,
   *       "method"="GET",
   *       "path"="/contact_people/{contactPersonId}/customers.{_format}",
   *       "read"=false,
   *       "requirements"={"contactPersonId"="\d+"},
   *       "filters"={
   *         Filter\RelatedCustomer::class
   *       }
   *     },

and everything works 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

Apply a filter to view select records in an Access database
Filtering is a useful way to see only the data that you want displayed in Access databases. You can use filters to display...
Read more >
Feature Request - paste filters to all selected clips - Suggestion
I want to be able to copy filters and paste them to multiple clips. Right now, they are only pasted onto the first...
Read more >
FEATURE REQUEST: Add Boolean Operators to filters ("OR ...
It seems to only allow the 'or/and/not' filter function for contacts? Does it allow this function for deals as well?
Read more >
Show the Feature Filtering Widget - Salesforce Help
Support buyers who prefer to apply filters for specific physical or operational criteria when discovering products. When you enable the Feature Filtering...
Read more >
Filter Policies by Target "Device-Tag" not possible with 9.1.x ...
As far as feature requests go, please check the following blog from not that ... Add actual tags to the policies which you...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found