@@ -160,18 +160,26 @@ there is an additional argument at the *start* of the list, `Example`. This
160
160
code is basically saying, "Listen to the 'do' event of the 'Example' target,
161
161
and, when notified, execute this callback."
162
162
163
- This is where the ` setIdentifiers() ` argument of ` EventManager ` comes into play.
163
+ This is where the ` setIdentifiers() ` method of ` EventManager ` comes into play.
164
164
The method allows passing an array of strings, defining the names of the context
165
165
or targets the given instance will be interested in.
166
166
167
167
So, getting back to our example, let's assume that the above shared listener is
168
- registered, and also that the ` Example ` class is defined as above. We can then
169
- execute the following:
168
+ registered, and also that the ` Example ` class is defined as above. (Note that as of
169
+ version 3, ` setSharedManager() ` is removed from ` EventManager ` ; the ` SharedEventManager `
170
+ instance must instead be injected via the constructor.) We can then execute the following:
170
171
171
172
``` php
172
173
$example = new Example();
174
+
175
+ // Prior to version 3:
173
176
$example->getEventManager()->setSharedManager($sharedEvents);
174
- $example->do('bar', 'bat');
177
+
178
+ // As of version 3:
179
+ $example->setEventManager(new EventManager($sharedEvents));
180
+
181
+ // Both versions:
182
+ $example->doIt('bar', 'bat');
175
183
```
176
184
177
185
and expect the following output:
0 commit comments