简体   繁体   English

如何在Symfony调试中显示自定义事件

[英]How to show custom events on symfony debug

I was trying to debug an event, and found this documentation from symfony , however all the events that are shown are: 我试图调试一个事件,并从symfony找到了该文档 ,但是显示的所有事件都是:

console.command
console.terminate
fos_elastica.post_transform
kernel.controller
kernel.exception
kernel.finish_request
kernel.request
kernel.response
kernel.terminate
kernel.view
security.interactive_login

None of the custom events show up, plus, we're defining the. 没有自定义事件显示,此外,我们正在定义。 But I see that besides the kernel, FOS is there also. 但是我看到,除了内核之外,FOS也存在。

I've got my listener registered in the following way: 我已经通过以下方式注册了侦听器:

company.domain.listener.service_pro_listener:
   class: Company\Domain\Listener\Customer\CustomerListener
   arguments:
     - '@company.command.executor'
   tags:
     - name: werkspot.domain.synchronized_event_listener
       event: 'Company\Domain\Event\Customer\RegisteredEvent'
       method: 'onRegisterPushToSalesforce'

The event is working, manual testing on the website I could validate that everything is working as expected. 该事件正在运行,可以在网站上进行手动测试,我可以验证所有功能均按预期运行。 Still it would have been much easier if I could simply confirm that everything were setup correctly through that command. 如果我可以简单地确认通过该命令正确设置了所有内容,那将容易得多。 So there must be a way show our events in command list. 因此,必须有一种在命令列表中显示事件的方法。

Is there anyway to achieve this? 反正有实现这一目标的方法吗?

It seems that you're using a custom event dispatcher (I see that by the tag on your listener service definition), while Symfony bin/console debug:event-dispatcher command will display the listeners of its own dispatcher. 似乎您正在使用自定义事件调度程序(我通过侦听器服务定义上的标记看到了这一点),而Symfony bin/console debug:event-dispatcher命令将显示其自身调度程序的侦听器。

So to do what you want, you will have to implement your own command to debug your own dispatcher, or change the dispatcher used to use the one from Symfony. 因此,要做您想做的事情,您将必须实现自己的命令来调试自己的调度程序,或者更改用于使用Symfony中的调度程序的调度程序。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM