Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 25c1cfc

Browse files
matthieu88160xabbuh
authored andcommitted
Update event_dispatcher.rst for consistency
1 parent 547227f commit 25c1cfc

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

components/event_dispatcher.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ A call to the dispatcher's ``addListener()`` method associates any valid
135135
PHP callable to an event::
136136

137137
$listener = new AcmeListener();
138-
$dispatcher->addListener('acme.action', array($listener, 'onFooAction'));
138+
$dispatcher->addListener('acme.foo.action', array($listener, 'onFooAction'));
139139

140140
The ``addListener()`` method takes up to three arguments:
141141

@@ -161,12 +161,12 @@ The ``addListener()`` method takes up to three arguments:
161161

162162
use Symfony\Component\EventDispatcher\Event;
163163

164-
$dispatcher->addListener('foo.action', function (Event $event) {
165-
// will be executed when the foo.action event is dispatched
164+
$dispatcher->addListener('acme.foo.action', function (Event $event) {
165+
// will be executed when the acme.foo.action event is dispatched
166166
});
167167

168168
Once a listener is registered with the dispatcher, it waits until the event
169-
is notified. In the above example, when the ``foo.action`` event is dispatched,
169+
is notified. In the above example, when the ``acme.foo.action`` event is dispatched,
170170
the dispatcher calls the ``AcmeListener::onFooAction()`` method and passes
171171
the ``Event`` object as the single argument::
172172

@@ -216,7 +216,7 @@ determine which instance is passed.
216216
// register your event listener service
217217
$listener = new Definition(\AcmeListener::class);
218218
$listener->addTag('kernel.event_listener', array(
219-
'event' => 'foo.action',
219+
'event' => 'acme.foo.action',
220220
'method' => 'onFooAction',
221221
));
222222
$containerBuilder->setDefinition('listener_service_id', $listener);

0 commit comments

Comments
 (0)