对于Symfony 2控制器,是否有类似beforeAction
的方法?此外,整个捆绑/项目是否有通用beforeAction
?
答案 0 :(得分:8)
不,遗憾的是,symfony2中没有preExecute
个等价物,但您可以访问更强大的事件模型。
This article解释了如何添加监听器。
您要收听的事件是onCoreController
另见:http://symfony.com/doc/2.0/book/internals.html#the-event-dispatcher