简体   繁体   中英

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?

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 

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM