Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I add a Doctrine filter in Symfony?

I am adding a filter for Doctrine 2 in a Symfony 2 project. Following the document I have created the filter class and put it under MyVendor\MyProjectBundle\Filter\MyFilter.php. What is the better way to do the configuration ane disabling/enabling bits as in the document? I do not know how to access the config object for Doctrine 2 in Symfony. Also if the filter is to be enabled globally, are there ways to do this without changingi every controller?

like image 257
Pomin Wu Avatar asked Nov 01 '12 04:11

Pomin Wu


1 Answers

Search for the filter word in the Doctrine bundle configuration reference.

The example from the doc looks like this:

doctrine:
    orm:
        filters:
            myFilter:
                class: MyVendor\MyBundle\Filters\MyFilter
                enabled: true
                parameters:
                    myParameter: myValue
                    mySecondParameter: mySecondValue
like image 106
Elnur Abdurrakhimov Avatar answered Sep 20 '22 05:09

Elnur Abdurrakhimov