@@ -50,9 +50,10 @@ Here are some examples of good event names:
50
50
* response.filter_content
51
51
52
52
.. note ::
53
- You can of course extend the ``Event `` class to specialize an event further,
54
- or enforce some constraints, but most of the time it adds an unnecessary
55
- level of complexity.
53
+
54
+ You can of course extend the ``Event `` class to specialize an event
55
+ further, or enforce some constraints, but most of the time it adds an
56
+ unnecessary level of complexity.
56
57
57
58
Besides its name, an ``Event `` instance can store additional data about the
58
59
notified event:
@@ -111,24 +112,27 @@ The ``connect()`` method takes two arguments:
111
112
* A PHP callable to call when the event is notified.
112
113
113
114
.. note ::
114
- A `PHP callable `_ is a PHP variable that can be used by the
115
- ``call_user_func() `` function and returns ``true `` when passed to the
116
- ``is_callable() `` function. It can be a ``\Closure `` instance, a string
117
- representing a function, or an array representing an object method or a
118
- class method.
115
+
116
+ A `PHP callable `_ is a PHP variable that can be used by the
117
+ ``call_user_func() `` function and returns ``true `` when passed to the
118
+ ``is_callable() `` function. It can be a ``\Closure `` instance, a string
119
+ representing a function, or an array representing an object method or a
120
+ class method.
119
121
120
122
Once a listener is registered with the dispatcher, it waits until the event is
121
123
notified. For the above example, the dispatcher calls ``$callable `` whenever
122
124
the ``user.change_culture `` event is notified; the listener receives an
123
125
``Event `` instance as an argument.
124
126
125
127
.. note ::
126
- The listeners are called by the event dispatcher in the same order you
127
- connected them.
128
+
129
+ The listeners are called by the event dispatcher in the same order you
130
+ connected them.
128
131
129
132
.. tip ::
130
- If you use the Symfony2 MVC framework, listeners are automatically
131
- registered based on your :ref: `configuration <kernel_listener_tag >`.
133
+
134
+ If you use the Symfony2 MVC framework, listeners are automatically
135
+ registered based on your :ref: `configuration <kernel_listener_tag >`.
132
136
133
137
.. index ::
134
138
single: Event Dispatcher; Notification
0 commit comments