我也使用自定义过滤器,在此过滤器中,您可以检索当前模块:
<?PHP class customFilter extends sfFilter { public function execute ($filterChain) { $context = $this->getContext(); if ('moduleName' == $context->getModuleName()) { // jump to the next filter return $filterChain->execute(); } // other stuff } }
否则,您还可以在filters.yml文件中提供已排除的模块:
customFilter: class: customFilter param: module_excluded: moduleName
在课堂上:
<?PHP class customFilter extends sfFilter { public function execute ($filterChain) { $context = $this->getContext(); if ($this->getParameter('module_excluded') == $context->getModuleName()) { // jump to the next filter return $filterChain->execute(); } // other stuff } }