Browse files

minor #4859 [Components][EventDispatcher] don't explain deprecated `g…

…etName()` method (xabbuh)

This PR was merged into the 2.5 branch.


[Components][EventDispatcher] don't explain deprecated `getName()` method

| Q             | A
| ------------- | ---
| Doc fix?      | yes
| New docs?     | no
| Applies to    | 2.5+
| Fixed tickets |


430de15 don't explain deprecated `getName()` method
  • Loading branch information...
weaverryan committed Jan 25, 2015
2 parents 62248df + 430de15 commit 33914c9ec3090b2a28cefa120c4f83c7c4542b7b
Showing with 8 additions and 9 deletions.
  1. +8 −9 components/event_dispatcher/introduction.rst
@@ -626,22 +626,21 @@ and so on...
Event Name Introspection
Since the ``EventDispatcher`` already knows the name of the event when dispatching
it, the event name is also injected into the
:class:`Symfony\\Component\\EventDispatcher\\Event` objects, making it available
to event listeners via the :method:`Symfony\\Component\\EventDispatcher\\Event::getName`
.. versionadded:: 2.4
Before Symfony 2.4, the event name and the event dispatcher had to be
requested from the ``Event`` instance. These methods are now deprecated.
The event name, (as with any other data in a custom event object) can be used as
part of the listener's processing logic::
The ``EventDispatcher`` instance, as well as the name of the event that is
dispatched, are passed as arguments to the listener::
use Symfony\Component\EventDispatcher\Event;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
class Foo
public function myEventListener(Event $event)
public function myEventListener(Event $event, $eventName, EventDispatcherInterface $dispatcher)
echo $event->getName();
echo $eventName;

0 comments on commit 33914c9

Please sign in to comment.