Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork5.3k
[Component][EventDispatcher] documentation for the TraceableEventDispatcher#3916
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Merged
weaverryan merged 1 commit intosymfony:2.3fromxabbuh:issue-3879-traceable-event-dispatcherJun 10, 2014
Uh oh!
There was an error while loading.Please reload this page.
Merged
Changes fromall commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Jump to file
Failed to load files.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
There are no files selected for viewing
1 change: 1 addition & 0 deletionscomponents/event_dispatcher/index.rst
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -8,3 +8,4 @@ EventDispatcher | ||
| container_aware_dispatcher | ||
| generic_event | ||
| immutable_dispatcher | ||
| traceable_dispatcher | ||
46 changes: 46 additions & 0 deletionscomponents/event_dispatcher/traceable_dispatcher.rst
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,46 @@ | ||
| .. index:: | ||
| single: EventDispatcher; Debug | ||
| single: EventDispatcher; Traceable | ||
| The Traceable Event Dispatcher | ||
| ============================== | ||
| The :class:`Symfony\\Component\\HttpKernel\\Debug\\TraceableEventDispatcher` | ||
| is an event dispatcher that wraps any other event dispatcher and can then | ||
| be used to determine which event listeners have been called by the dispatcher. | ||
| Pass the event dispatcher to be wrapped and an instance of the | ||
| :class:`Symfony\\Component\\Stopwatch\\Stopwatch` to its constructor:: | ||
| use Symfony\Component\HttpKernel\Debug\TraceableEventDispatcher; | ||
| use Symfony\Component\Stopwatch\Stopwatch; | ||
| // the event dispatcher to debug | ||
| $eventDispatcher = ...; | ||
| $traceableEventDispatcher = new TraceableEventDispatcher($eventDispatcher, new Stopwatch()); | ||
| Now, the ``TraceableEventDispatcher`` can be used like any other event dispatcher | ||
| to register event listeners and dispatch events:: | ||
| // ... | ||
| // register an event listener | ||
| $eventListener = ...; | ||
| $priority = ...; | ||
| $traceableEventDispatcher->addListener('the-event-name', $eventListener, $priority); | ||
| // dispatch an event | ||
| $event = ...; | ||
| $traceableEventDispatcher->dispatch('the-event-name', $event); | ||
| After your application has been processed, you can use the | ||
| :method:`Symfony\\Component\\EventDispatcher\\Debug\\TraceableEventDispatcherInterface::getCalledListeners` | ||
| method to retrieve an array of event listeners that have been called in your | ||
| application. Similarly, the | ||
| :method:`Symfony\\Component\\EventDispatcher\\Debug\\TraceableEventDispatcherInterface::getNotCalledListeners` | ||
| method returns an array of event listeners that have not been called:: | ||
| // ... | ||
| $calledListeners = $traceableEventDispatcher->getCalledListeners(); | ||
| $notCalledListeners = $traceableEventDispatcher->getNotCalledListeners(); |
1 change: 1 addition & 0 deletionscomponents/map.rst.inc
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.