8000 Merge pull request #760 from mdpatrick/event_dispatcher_injection · GromNaN/symfony-docs@271c333 · GitHub
[go: up one dir, main page]

Skip to content

Commit 271c333

Browse files
committed
Merge pull request symfony#760 from mdpatrick/event_dispatcher_injection
Event dispatcher injection
2 parents a2900ef + 15f9072 commit 271c333
Copy full SHA for 271c333

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