symfony2admingenerator / AdmingeneratorGeneratorBundle

(old-legacy) Admingenerator for Symfony2, parse generator.yml files to build classes
http://symfony2admingenerator.org/
MIT License
360 stars 125 forks source link

How to get inverted filtering? #793

Closed d10r closed 10 years ago

d10r commented 10 years ago

We have a case where we need the filter to work in inverted mode. It should show all items where the column value does NOT match the given string. I couldn't find anything in the documentation showing how to do this. Is it already possible? If not, how could I work around the limitation?

ioleo commented 10 years ago

@bcg-didi it's possible in the new-unstable repository symfony2admingenerator/GeneratorBundle

However, that repository is right now only tested for Doctrine ORM.

In this (legacy) repository you can have a "not" scope (becouse you can overwrite scope behaviour), but you can't have a "not" filter.

d10r commented 10 years ago

thanks. If there's another possibilty to achieve this (without updating to unstable), please let me know.

ioleo commented 10 years ago

@bcg-didi well, the ListController class can be fully overriden by you. So you can capture the filters post and modify the query any way you want.

sescandell commented 10 years ago

Hi @bcg-didi

You can also overwritte the QueryFilter object by yours (https://github.com/symfony2admingenerator/AdmingeneratorGeneratorBundle/blob/master/QueryFilter/DoctrineQueryFilter.php) and rewrite all filters by changing "=" byt "<>" or anything else.