Skip to content
This repository was archived by the owner on Jan 29, 2020. It is now read-only.

Commit 5ef4add

Browse files
committed
Merge branch 'hotfix/44' into develop
Forward port #44
2 parents b3ae581 + c2f5e42 commit 5ef4add

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

doc/book/tutorial.md

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -160,18 +160,26 @@ there is an additional argument at the *start* of the list, `Example`. This
160160
code is basically saying, "Listen to the 'do' event of the 'Example' target,
161161
and, when notified, execute this callback."
162162

163-
This is where the `setIdentifiers()` argument of `EventManager` comes into play.
163+
This is where the `setIdentifiers()` method of `EventManager` comes into play.
164164
The method allows passing an array of strings, defining the names of the context
165165
or targets the given instance will be interested in.
166166

167167
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:
170171

171172
```php
172173
$example = new Example();
174+
175+
// Prior to version 3:
173176
$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');
175183
```
176184

177185
and expect the following output:

0 commit comments

Comments
 (0)