JmikolaWildcardEventDispatcherBundle icon indicating copy to clipboard operation
JmikolaWildcardEventDispatcherBundle copied to clipboard

Event profiling is disabled when using this bundle

Open andrewmatthews opened this issue 8 years ago • 0 comments

Hi,

When running Symfony in debug mode, it uses an event dispatcher that implements TraceableEventDispatcherInterface. The EventDataCollector class relies on an event dispatcher implementing this interface to get profiling data about the events during a request.

Since this bundle creates a new event dispatcher that wraps the original event dispatcher, and this new event dispatcher does not implement TraceableEventDispatcherInterface, no event data appears in the event section of the profiler.

I am not sure the best way to solve this, other than to have two WildcardEventDispatcher classes: the current one, and one that extends it and implements the TraceableEventDispatcherInterface. You would need to detect which one Symfony has loaded by default, then set the appropriate class for the WildcardEventDispatcher service.

Alternatively, you would need to ensure that the EventDataCollector is injected with the original Symfony event dispatcher, regardless of whether the WildcardEventDispatcher is instantiated or not.

If you have any other suggestions, please let me know.

Thanks,

Andrew.

andrewmatthews avatar Jan 16 '17 05:01 andrewmatthews