我正在编写一个服务来处理 AccessDeniedException 并且我找到了一种方法来解决它使用 Symfony2 的 AccessDeniedHandlerInterface https://stackoverflow.com/questions/9166930/using-symfony2s-accessdeniedhandlerinterface
firewalls:
secured_area:
.....
access_denied_handler: kernel.listener.accessDenied.handler
并在这里定义服务:
services:
kernel.listener.accessDenied.handler:
class: %kernel.listener.accessDenied.handler.class%
arguments: ["@service_container"]
tags:
- { name: 'kernel.event_listener', event: 'security.kernel_response', method: 'handle' }
但我不知道在哪里可以找到这些属性的定义,例如事件:'security.kernel_response'。 “security.kernel_response”在哪里定义,我可以在哪里获取其他事件的列表?
对于“access_denied_handler”等其他处理程序,如何确定相应服务的标签?
调试 Symfony 容器:
要调试服务容器,请使用以下控制台命令之一
当前版本 (> 2.7)
显示所有已注册的服务
app/console debug:container
按标签排序的列表
app/console debug:container --tags
通过单个标签过滤(即 form.type )
app/console debug:container --tag=form.type
并包括私人服务
app/console debug:container --show-private
版本 > 2.2 至
显示所有已注册的服务
app/console container:debug
按标签排序的列表
app/console container:debug --tags
通过单个标签过滤(即 form.type )
app/console container:debug --tag=form.type
并包括私人服务
app/console container:debug --show-private
版本
要快速查找服务/标签(或 symfony2.grep(Linux、OSX)或findstr( windows )有这样的管道:
app/console container:debug | grep form
or
app/console container:debug | findstr form
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)