私はカスタムフィルターにいくつかのことをさせています。
そして、特定のモジュールをフィルターチェーンに含めないようにしたい。言い換えると、このモジュールでは、カスタムフィルターをこのモジュールで実行せず、他のモジュールで実行する必要があります。
私はカスタムフィルターにいくつかのことをさせています。
そして、特定のモジュールをフィルターチェーンに含めないようにしたい。言い換えると、このモジュールでは、カスタムフィルターをこのモジュールで実行せず、他のモジュールで実行する必要があります。
私もカスタムフィルターを使用しており、このフィルター内で現在のモジュールを取得できます。
<?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
}
}