我正在将旧网站从 SF 1.x 转换为 S2。
旧代码中有一个类利用了 SF v1 过滤器链。这是该类的一个片段:
class myFilter extends sfFilter
{
    public function execute($filterChain)
    {
        // Execute this filter only once
        if ($this->isFirstCall())
        {
            // Filters don't have direct access to the request and user objects.
            // You will need to use the context object to get them
            $context = $this->getContext();
            $user = $context->getUser();
            if ($user->isAuthenticated())
            {                
                // Do something
            }
        }
        // Execute next filter
        $filterChain->execute();
    }
}
我希望能够实现这个功能,即窥探请求,并根据用户会话采取行动。看起来 SF 已经取消了过滤器链,我查看了 Symfony 内部的文档,但我找不到可以帮助我入门的东西(即上面的一个小片段)。
有谁知道我如何监听请求(可以通过 v1 中的过滤器链完成),但使用 SF2 中提供的新机制?
一个片段来展示如何做到这一点将不胜感激。