8000 Added example for injection of event_dispatcher service · GromNaN/symfony-docs@15f9072 · GitHub
[go: up one dir, main page]

Skip to content

Commit 15f9072

Browse files
committed
Added example for injection of event_dispatcher service
1 parent aba1a9f commit 15f9072

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

book/internals.rst

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -748,8 +748,16 @@ can be the way to go, especially for optional dependencies.
748748

749749
If you use dependency injection like we did in the two examples above, you
750750
can then use the `Symfony2 Dependency Injection component`_ to elegantly
751-
manage these objects.
751+
manage the injection of the event_dispatcher service for these objects.
752752

753+
.. code-block:: yml
754+
755+
# src/Acme/HelloBundle/Resources/config/services.yml
756+
services:
757+
foo_service:
758+
class: Acme/HelloBundle/Foo/FooService
759+
arguments: [@event_dispatcher]
760+
753761
.. index::
754762
single: Event Dispatcher; Event subscribers
755763

0 commit comments

Comments
 (0)
0