Skip to content
This repository

Feature/eventmanager di usability #944

Merged
merged 6 commits into from about 2 years ago

3 participants

Matthew Weier O'Phinney Marco Pivetta Rob Allen
Matthew Weier O'Phinney
Owner

Shared Collections support for EventManager

This is a solution for usage of the StaticEventManager. Basically, it
will instead expect the following:

  • Classes composing an EventManager will implement EventManagerAware, and thus opt-in to setter injection of an EM instance
    • EM instances will not be shared between classes
  • The EM implements the SharedEventManagerAware interface, indicating it opts-in to setter injection of a SharedEventManager (note: not static)
    • A single "SharedEventManager" will be shared between all instances of EventManager

This commit does the following:

  • Renames StaticEventCollection to SharedEventCollection
  • Creates SharedEventManager, which implements all the functionality of StaticEventManager except the singleton aspects.
  • StaticEventManager now extends SharedEventManager, and simply implements a singleton pattern.
  • Introduced EventManagerAware and SharedEventManagerAware interfaces; EventManager implements the latter.
  • Adds configuration to the Bootstrap in setupLocator() to mark the EventManager as an unshared instance.

One issue is known, however:

  • Zend\Module\Listener\LocatorRegistration currently fails, as it assumes a StaticEventManager instance. As such, it cannot connect to the bootstrap event. I'm not sure what the solution for this will be -- I assume we'll need to instantiate a SharedEventManager and pass it into the Module\Manager, Mvc\Bootstrap, and potentially Mvc\Application. This will require documentation, and coordination with the skeleton application. Another alternative is to have this listener instead attach directly to the Bootstrap, and loop through the module manager. Ideas are welcome.
Marco Pivetta
Collaborator

Hey matt,
somehow missed this PR before (I'm really transient these weeks), but here I still see a big problem that can't be solved easily anyway, which is the singleton pattern.

Here's my use-case in short:

  1. Bootstrap "admin wrapper" application, run it
  2. Load ACL/whatever in "dispatch"
  3. Bootstrap sub-application (within dispatch) and inject ACL/whatever in it's service locator
  4. Run sub-application
  5. Use the response of the sub-application as response for the "admin wrapper" application

So the problem is that using a singleton would obviously re-triggering the dispatch (and the other MVC events) from the sub-application would affect the main application. Maybe I'm approaching the problem incorrectly, but the main issue still remains... Or am I getting this wrong?

Matthew Weier O'Phinney
Owner
Marco Pivetta
Collaborator

Aha, then I'll have to read through it with more care when I got some spare time... Thank you :)

Matthew Weier O'Phinney
Owner

@Ocramius So, I was replying from my phone over the weekend. Here's a better explanation. :)

The current architecture is that each class composing an EventManager receives a unique EventManager instance. This allows you to attach listeners locally, and they will only be notified if this EM instance triggers that event. Additionally, we have the concept of a "SharedEventManager". This is essentially simply a collection of listeners on events on specific contexts -- which are typically class names. The same instance of a SharedEventManager is injected into all EventManager instances (a capability recently made possible with the DIC). What this allows you to do is to listen to an event when you do not have direct access to the object or EM -- e.g., because it may not exist yet. When the EM triggers an event, it queries not only for local listeners on that event, but also those on the SharedEventManager, if any is composed.

(The StaticEventManager, as of this PR, is simply an extension of the SharedEventManager that implements a singleton interface; we would not be using it internally in the framework, but only providing it for those who want to use it.)

The key part of the SharedEventManager to note is that it has both the concept of an event and a context -- the latter allows fine-grained attachment of listeners -- so that if you want a "dispatch" listener on controllers, but not the application, you can use the context to make this happen. (This has been true of the StaticEventManager previous to this commit as well.)

Marco Pivetta
Collaborator

Thank you for explaining that :) I still have to wrap my mind around it, still haven't got any free time by now :\

Rob Allen
Collaborator

Update for clean merge and docs to be added by @weierophinney

added some commits March 19, 2012
Matthew Weier O'Phinney Shared Collections support for EventManager
This is a solution for usage of the StaticEventManager. Basically, it
will instead expect the following:

- Classes composing an EventManager will implement EventManagerAware,
  and thus opt-in to setter injection of an EM instance
  - EM instances will _not_ be shared between classes
- The EM implements the SharedEventManagerAware interface, indicating it
  opts-in to setter injection of a SharedEventManager (note: not static)
  - A single "SharedEventManager" will be shared between all instances of
    EventManager

This commit does the following:

- Renames StaticEventCollection to SharedEventCollection
- Creates SharedEventManager, which implements all the functionality of
  StaticEventManager except the singleton aspects.
- StaticEventManager now extends SharedEventManager, and simply
  implements a singleton pattern.
- Introduced EventManagerAware and SharedEventManagerAware interfaces;
  EventManager implements the latter.
- Adds configuration to the Bootstrap in setupLocator() to mark the EventManager
  as an unshared instance.

It depends on work @ralphschindler is doing in his
feature/di-share-configuration branch.
2f06e47
Matthew Weier O'Phinney Updated events-aware classes to implement EventManagerAware
- Updated classes to implement EventManagerAware
- Updated tests to use SharedEventManager instead of StaticEventManager
f9ebfe7
Matthew Weier O'Phinney Renames for consistency
- s/SharedEventManagerAware/SharedEventCollectionAware/, as the
  interface was typehinting on the latter.
- s/setSharedConnections/setSharedCollections/, as the latter is the
  terminology in the interface
- s/sharedConnections/sharedCollections/, for the same reasons as the
  previous point
674881a
Matthew Weier O'Phinney
Owner

Will now merge cleanly; need to (a) update docs, and (b) re-enable StaticEventManager awareness temporarily.

added some commits April 19, 2012
Matthew Weier O'Phinney [#944] re-enable StaticEventManager awareness
- Re-enables StaticEventManager awareness temporarily until
  Application/Bootstrap is refactored to allow sharing a
  SharedEventManager instance and injecting into many discrete
  EventManager instances.
ac5535c
Matthew Weier O'Phinney [#944] Updated documentation
- Updated documentation to reference SharedEventCollection and SharedEventManager
- Made a note about StaticEventManager and that it's deprecated for use inside the framework
ef5fe43
Matthew Weier O'Phinney
Owner

@akrabat Docs are updated, StaticEventManager usage (temporarily) reinstated, and merge conflicts handled. Ready to go!

Matthew Weier O'Phinney [#944] Fix failing tests due to EM changes
- Removed setEventManager() from ModuleHandler interface (cannot
  redefine methods when extending interfaces)
- s/(setSharedCo)ll(ections)/\1nn\2/ in MVC tests
0c5f6d8
Rob Allen akrabat merged commit 0c5f6d8 into from April 20, 2012
Rob Allen akrabat closed this April 20, 2012
Deleted user Unknown referenced this pull request from a commit April 19, 2012
Matthew Weier O'Phinney [#944] re-enable StaticEventManager awareness
- Re-enables StaticEventManager awareness temporarily until
  Application/Bootstrap is refactored to allow sharing a
  SharedEventManager instance and injecting into many discrete
  EventManager instances.
a0105cf
Deleted user Unknown referenced this pull request from a commit April 19, 2012
Matthew Weier O'Phinney [#944] Updated documentation
- Updated documentation to reference SharedEventCollection and SharedEventManager
- Made a note about StaticEventManager and that it's deprecated for use inside the framework
a78b566
Deleted user Unknown referenced this pull request from a commit April 20, 2012
Matthew Weier O'Phinney [#944] Fix failing tests due to EM changes
- Removed setEventManager() from ModuleHandler interface (cannot
  redefine methods when extending interfaces)
- s/(setSharedCo)ll(ections)/\1nn\2/ in MVC tests
e512728
Henrik Hautakoski pnx referenced this pull request from a commit in pnx/zf1 March 26, 2012
Backported #944 from ZF2
- see zendframework/zf2#944
- renames StaticEventCollection to SharedEventCollection
- creates SharedEventManager, which implements SharedEventCollection, and is not
  a singleton
- StaticEventManager now extends SharedEventManager and implements a singleton

git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@24700 44c647ce-9c0f-0410-b52a-842ac1e357ba
d72df5f
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Showing 6 unique commits by 1 author.

Apr 19, 2012
Matthew Weier O'Phinney Shared Collections support for EventManager
This is a solution for usage of the StaticEventManager. Basically, it
will instead expect the following:

- Classes composing an EventManager will implement EventManagerAware,
  and thus opt-in to setter injection of an EM instance
  - EM instances will _not_ be shared between classes
- The EM implements the SharedEventManagerAware interface, indicating it
  opts-in to setter injection of a SharedEventManager (note: not static)
  - A single "SharedEventManager" will be shared between all instances of
    EventManager

This commit does the following:

- Renames StaticEventCollection to SharedEventCollection
- Creates SharedEventManager, which implements all the functionality of
  StaticEventManager except the singleton aspects.
- StaticEventManager now extends SharedEventManager, and simply
  implements a singleton pattern.
- Introduced EventManagerAware and SharedEventManagerAware interfaces;
  EventManager implements the latter.
- Adds configuration to the Bootstrap in setupLocator() to mark the EventManager
  as an unshared instance.

It depends on work @ralphschindler is doing in his
feature/di-share-configuration branch.
2f06e47
Matthew Weier O'Phinney Updated events-aware classes to implement EventManagerAware
- Updated classes to implement EventManagerAware
- Updated tests to use SharedEventManager instead of StaticEventManager
f9ebfe7
Matthew Weier O'Phinney Renames for consistency
- s/SharedEventManagerAware/SharedEventCollectionAware/, as the
  interface was typehinting on the latter.
- s/setSharedConnections/setSharedCollections/, as the latter is the
  terminology in the interface
- s/sharedConnections/sharedCollections/, for the same reasons as the
  previous point
674881a
Matthew Weier O'Phinney [#944] re-enable StaticEventManager awareness
- Re-enables StaticEventManager awareness temporarily until
  Application/Bootstrap is refactored to allow sharing a
  SharedEventManager instance and injecting into many discrete
  EventManager instances.
ac5535c
Matthew Weier O'Phinney [#944] Updated documentation
- Updated documentation to reference SharedEventCollection and SharedEventManager
- Made a note about StaticEventManager and that it's deprecated for use inside the framework
ef5fe43
Apr 20, 2012
Matthew Weier O'Phinney [#944] Fix failing tests due to EM changes
- Removed setEventManager() from ModuleHandler interface (cannot
  redefine methods when extending interfaces)
- s/(setSharedCo)ll(ections)/\1nn\2/ in MVC tests
0c5f6d8
This page is out of date. Refresh to see the latest.

Showing 21 changed files with 435 additions and 270 deletions. Show diff stats Hide diff stats

  1. 134  documentation/manual/en/module_specs/Zend_EventManager-EventManager.xml
  2. 5  library/Zend/Cache/Storage/Adapter/AbstractAdapter.php
  3. 78  library/Zend/EventManager/EventManager.php
  4. 42  library/Zend/EventManager/EventManagerAware.php
  5. 4  library/Zend/EventManager/{StaticEventCollection.php → SharedEventCollection.php}
  6. 42  library/Zend/EventManager/SharedEventCollectionAware.php
  7. 149  library/Zend/EventManager/SharedEventManager.php
  8. 113  library/Zend/EventManager/StaticEventManager.php
  9. 12  library/Zend/Module/ModuleHandler.php
  10. 12  library/Zend/Mvc/AppContext.php
  11. 15  library/Zend/Mvc/Bootstrap.php
  12. 3  library/Zend/Mvc/Controller/ActionController.php
  13. 3  library/Zend/Mvc/Controller/RestfulController.php
  14. 3  library/Zend/View/View.php
  15. 3  tests/Zend/EventManager/EventManagerTest.php
  16. 7  tests/Zend/EventManager/StaticEventManagerTest.php
  17. 24  tests/Zend/EventManager/StaticIntegrationTest.php
  18. 4  tests/Zend/EventManager/TestAsset/StaticEventsMock.php
  19. 26  tests/Zend/Mvc/ApplicationTest.php
  20. 13  tests/Zend/Mvc/Controller/ActionControllerTest.php
  21. 13  tests/Zend/Mvc/Controller/RestfulControllerTest.php
134  documentation/manual/en/module_specs/Zend_EventManager-EventManager.xml
@@ -32,9 +32,9 @@
32 32
         </itemizedlist>
33 33
 
34 34
         <para>
35  
-            The basic architecture allows you to attach and detach listeners to named events, both on
36  
-            a per-instance basis as well as statically; trigger events; and interrupt execution of
37  
-            listeners.
  35
+            The basic architecture allows you to attach and detach listeners to named events, both
  36
+            on a per-instance basis as well as via shared collections; trigger events; and interrupt
  37
+            execution of listeners.
38 38
         </para>
39 39
     </section>
40 40
  
@@ -47,18 +47,27 @@
47 47
 
48 48
         <programlisting language="php"><![CDATA[
49 49
 use Zend\EventManager\EventCollection,
50  
-    Zend\EventManager\EventManager;
  50
+use Zend\EventManager\EventManager;
  51
+use Zend\EventManager\EventManagerAware;
51 52
 
52  
-class Foo
  53
+class Foo implements EventManagerAware
53 54
 {
54 55
     protected $events;
55 56
 
56  
-    public function events(EventCollection $events = null)
  57
+    public function setEventManager(EventCollection $events)
  58
+    {
  59
+        $events->setIdentifiers(array(
  60
+            __CLASS__,
  61
+            get_called_class(),
  62
+        ));
  63
+        $this->events = $events;
  64
+        return $this;
  65
+    }
  66
+
  67
+    public function events()
57 68
     {
58  
-        if (null !== $events) {
59  
-            $this->events = $events;
60  
-        } elseif (null === $this->events) {
61  
-            $this->events = new EventManager(__CLASS__);
  69
+        if (null === $this->events) {
  70
+            $this->setEventManager(new EventManager());
62 71
         }
63 72
         return $this->events;
64 73
     }
@@ -133,23 +142,30 @@ $foo->bar('baz', 'bat');
133 142
 
134 143
         <para>
135 144
             Sometimes you may want to specify listeners without yet having an object instance of the
136  
-            class composing an <classname>EventManager</classname>. The
137  
-            <classname>StaticEventManager</classname> allows you to do this. The call to
  145
+            class composing an <classname>EventManager</classname>. Zend Framework enables this
  146
+            through the concept of a <interfacename>SharedEventCollection</interfacename>. Simply
  147
+            put, you can inject individual <classname>EventManager</classname> instances with a
  148
+            well-known <interfacename>SharedEventCollection</interfacename>, and the
  149
+            <classname>EventManager</classname> instance will query it for additional listeners.
  150
+            Listeners attach to a <interfacename>SharedEventCollection</interfacename> in roughly
  151
+            the same way the do normal event managers; the call to
138 152
             <methodname>attach</methodname> is identical to the <classname>EventManager</classname>,
139 153
             but expects an additional parameter at the beginning: a named instance. Remember the
140 154
             example of composing an <classname>EventManager</classname>, how we passed it
141 155
             <constant>__CLASS__</constant>? That value, or any strings you provide in an array to
142  
-            the constructor, may be used to identify an instance when using the
143  
-            <classname>StaticEventManager</classname>. As an example, we could change the above
144  
-            example to attach statically:
  156
+            the constructor, may be used to identify an instance when using a
  157
+            <interfacename>SharedEventCollection</interfacename>. As an example, assuming we have a
  158
+            <classname>SharedEventManager</classname> instance that we know has been injected in our
  159
+            <classname>EventManager</classname> instances (for instance, via dependency injection),
  160
+            we could change the above example to attach via the shared collection:
145 161
         </para>
146 162
 
147 163
         <programlisting language="php"><![CDATA[
148  
-use Zend\EventManager\StaticEventManager,
149  
-    Zend\Log\Factory as LogFactory;
  164
+use Zend\Log\Factory as LogFactory;
  165
+
  166
+// Assume $events is a Zend\EventManager\SharedEventManager instance
150 167
 
151 168
 $log = LogFactory($someConfig);
152  
-$events = StaticEventManager::getInstance();
153 169
 $events->attach('Foo', 'bar', function ($e) use ($log) {
154 170
     $event  = $e->getName();
155 171
     $target = get_class($e->getTarget());
@@ -165,6 +181,7 @@ $events->attach('Foo', 'bar', function ($e) use ($log) {
165 181
 
166 182
 // Later, instantiate Foo:
167 183
 $foo = new Foo();
  184
+$foo->events()->setSharedEventCollection($events);
168 185
 
169 186
 // And we can still trigger the above event:
170 187
 $foo->bar('baz', 'bat');
@@ -172,6 +189,25 @@ $foo->bar('baz', 'bat');
172 189
 // bar called on Foo, using params {"baz" : "baz", "bat" : "bat"}"
173 190
 ]]></programlisting>
174 191
 
  192
+        <note>
  193
+            <info><title>StaticEventManager</title></info>
  194
+
  195
+            <para>
  196
+                As of 2.0.0beta3, you can use the <classname>StaticEventManager</classname>
  197
+                singleton as a <interfacename>SharedEventCollection</interfacename>. As such, you do
  198
+                not need to worry about where and how to get access to the
  199
+                <interfacename>SharedEventCollection</interfacename>; it's globally available by
  200
+                simply calling <code>StaticEventManager::getInstance()</code>.
  201
+            </para>
  202
+
  203
+            <para>
  204
+                Be aware, however, that its usage is deprecated within the framework, and starting
  205
+                with 2.0.0beta4, you will instead configure a
  206
+                <classname>SharedEventManager</classname> instance that will be injected by the
  207
+                framework into individual <classname>EventManager</classname> instances.
  208
+            </para>
  209
+        </note>
  210
+
175 211
         <para>
176 212
             The <classname>EventManager</classname> also provides the ability to detach listeners,
177 213
             short-circuit execution of an event either from within a listener or by testing return
@@ -184,8 +220,8 @@ $foo->bar('baz', 'bat');
184 220
 
185 221
             <para>
186 222
                 Sometimes you'll want to attach the same listener to many events or to all events of
187  
-                a given instance -- or potentially, with the static manager, many contexts, and many
188  
-                events. The <classname>EventManager</classname> component allows for this.
  223
+                a given instance -- or potentially, with a shared event collection, many contexts,
  224
+                and many events. The <classname>EventManager</classname> component allows for this.
189 225
             </para>
190 226
 
191 227
             <example xml:id="zend.event-manager.event-manager.quick-start.wildcard.many">
@@ -221,11 +257,11 @@ $events->attach('*', $callback);
221 257
                 </para>
222 258
             </example>
223 259
 
224  
-            <example xml:id="zend.event-manager.event-manager.quick-start.wildcard.static-many">
225  
-                <title>Attaching to many events at once via the StaticEventManager</title>
  260
+            <example xml:id="zend.event-manager.event-manager.quick-start.wildcard.shared-many">
  261
+                <title>Attaching to many events at once via a SharedEventManager</title>
226 262
 
227 263
                 <programlisting language="php"><![CDATA[
228  
-$events = StaticEventManager::getInstance();
  264
+$events = new SharedEventManager();
229 265
 // Attach to many events on the context "foo"
230 266
 $events->attach('foo', array('these', 'are', 'event', 'names'), $callback);
231 267
 
@@ -239,11 +275,11 @@ $events->attach(array('foo', 'bar'), array('these', 'are', 'event', 'names'), $c
239 275
                 </para>
240 276
             </example>
241 277
 
242  
-            <example xml:id="zend.event-manager.event-manager.quick-start.wildcard.static-wildcard">
243  
-                <title>Attaching to many events at once via the StaticEventManager</title>
  278
+            <example xml:id="zend.event-manager.event-manager.quick-start.wildcard.shared-wildcard">
  279
+                <title>Attaching to many events at once via a SharedEventManager</title>
244 280
 
245 281
                 <programlisting language="php"><![CDATA[
246  
-$events = StaticEventManager::getInstance();
  282
+$events = new SharedEventManager();
247 283
 // Attach to all events on the context "foo"
248 284
 $events->attach('foo', '*', $callback);
249 285
 
@@ -277,7 +313,7 @@ $events->attach(array('foo', 'bar'), '*', $callback);
277 313
                     <para>
278 314
                         A string or array of strings to which the given
279 315
                         <classname>EventManager</classname> instance can answer when accessed via
280  
-                        the <classname>StaticEventManager</classname>.
  316
+                        a <interfacename>SharedEventManager</interfacename>.
281 317
                     </para>
282 318
                 </listitem>
283 319
             </varlistentry>
@@ -294,16 +330,12 @@ $events->attach(array('foo', 'bar'), '*', $callback);
294 330
             </varlistentry>
295 331
 
296 332
             <varlistentry>
297  
-                <term>static_connections</term>
  333
+                <term>shared_collections</term>
298 334
  
299 335
                 <listitem>
300 336
                     <para>
301  
-                        An instance of a <interfacename>StaticEventCollection</interfacename>
302  
-                        instance to use when triggering events. By default, this will use
303  
-                        the global <classname>StaticEventManager</classname> instance, but that can
304  
-                        be overridden by passing a value to this method. A <constant>null</constant>
305  
-                        value will prevent the instance from triggering any further statically
306  
-                        attached listeners.
  337
+                        An instance of a <interfacename>SharedEventCollection</interfacename>
  338
+                        instance to use when triggering events. 
307 339
                     </para>
308 340
                 </listitem>
309 341
             </varlistentry>
@@ -325,7 +357,7 @@ $events->attach(array('foo', 'bar'), '*', $callback);
325 357
                     </methodsynopsis>
326 358
                     <para>
327 359
                         Constructs a new <classname>EventManager</classname> instance, using the
328  
-                        given identifier, if provided, for purposes of static attachment.
  360
+                        given identifier, if provided, for purposes of shared collections.
329 361
                     </para>
330 362
                 </listitem>
331 363
             </varlistentry>
@@ -346,42 +378,34 @@ $events->attach(array('foo', 'bar'), '*', $callback);
346 378
                 </listitem>
347 379
             </varlistentry>
348 380
 
349  
-            <varlistentry xml:id="zend.event-manager.event-manager.methods.set-static-connections">
350  
-                <term>setStaticConnections</term>
  381
+            <varlistentry xml:id="zend.event-manager.event-manager.methods.set-shared-collections">
  382
+                <term>setSharedCollections</term>
351 383
                 <listitem>
352 384
                     <methodsynopsis>
353  
-                        <methodname>setStaticConnections</methodname>
  385
+                        <methodname>setSharedCollections</methodname>
354 386
                         <methodparam>
355  
-                            <funcparams>StaticEventCollection $connections = null</funcparams>
  387
+                            <funcparams>SharedEventCollection $collections = null</funcparams>
356 388
                         </methodparam>
357 389
                     </methodsynopsis>
358 390
                     <para>
359  
-                        An instance of a <interfacename>StaticEventCollection</interfacename>
360  
-                        instance to use when triggering events. By default, this will use
361  
-                        the global <classname>StaticEventManager</classname> instance, but that can
362  
-                        be overridden by passing a value to this method. A <constant>null</constant>
363  
-                        value will prevent the instance from triggering any further statically
364  
-                        attached listeners.
  391
+                        An instance of a <interfacename>SharedEventCollection</interfacename>
  392
+                        instance to use when triggering events. 
365 393
                     </para>
366 394
                 </listitem>
367 395
             </varlistentry>
368 396
 
369  
-            <varlistentry xml:id="zend.event-manager.event-manager.methods.get-static-connections">
370  
-                <term>getStaticConnections</term>
  397
+            <varlistentry xml:id="zend.event-manager.event-manager.methods.get-shared-collections">
  398
+                <term>getSharedCollections</term>
371 399
                 <listitem>
372 400
                     <methodsynopsis>
373  
-                        <methodname>getStaticConnections</methodname>
  401
+                        <methodname>getSharedCollections</methodname>
374 402
                         <void/>
375 403
                     </methodsynopsis>
376 404
                     <para>
377 405
                         Returns the currently attached
378  
-                        <interfacename>StaticEventCollection</interfacename> instance, lazily
379  
-                        retrieving the global <classname>StaticEventManager</classname> instance if
380  
-                        none is attached and usage of static listeners hasn't been disabled by
381  
-                        passing a <constant>null</constant> value to <link
382  
-                            linkend="zend.event-manager.event-manager.methods.set-static-connections">setStaticConnections()</link>.
383  
-                        Returns either a boolean <constant>false</constant> if static listeners are
384  
-                        disabled, or a <interfacename>StaticEventCollection</interfacename> instance
  406
+                        <interfacename>SharedEventCollection</interfacename> instance.
  407
+                        Returns either a <constant>null</constant> if no collection is attached,
  408
+                        or a <interfacename>SharedEventCollection</interfacename> instance
385 409
                         otherwise.
386 410
                     </para>
387 411
                 </listitem>
5  library/Zend/Cache/Storage/Adapter/AbstractAdapter.php
@@ -33,7 +33,8 @@
33 33
     Zend\Cache\Storage\PostEvent,
34 34
     Zend\Cache\Storage\Plugin,
35 35
     Zend\EventManager\EventCollection,
36  
-    Zend\EventManager\EventManager;
  36
+    Zend\EventManager\EventManager,
  37
+    Zend\EventManager\EventManagerAware;
37 38
 
38 39
 /**
39 40
  * @category   Zend
@@ -42,7 +43,7 @@
42 43
  * @copyright  Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
43 44
  * @license    http://framework.zend.com/license/new-bsd     New BSD License
44 45
  */
45  
-abstract class AbstractAdapter implements Adapter
  46
+abstract class AbstractAdapter implements Adapter, EventManagerAware
46 47
 {
47 48
     /**
48 49
      * The used EventManager if any
78  library/Zend/EventManager/EventManager.php
@@ -38,7 +38,7 @@
38 38
  * @copyright  Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
39 39
  * @license    http://framework.zend.com/license/new-bsd     New BSD License
40 40
  */
41  
-class EventManager implements EventCollection
  41
+class EventManager implements EventCollection, SharedEventCollectionAware
42 42
 {
43 43
     /**
44 44
      * Subscribed events and their listeners
@@ -52,22 +52,22 @@ class EventManager implements EventCollection
52 52
     protected $eventClass = 'Zend\EventManager\Event';
53 53
 
54 54
     /**
55  
-     * Identifiers, used to pull static signals from StaticEventManager
  55
+     * Identifiers, used to pull shared signals from SharedEventCollection instance
56 56
      * @var array
57 57
      */
58 58
     protected $identifiers = array();
59 59
 
60 60
     /**
61  
-     * Static connections
62  
-     * @var false|null|StaticEventCollection
  61
+     * Shared connections
  62
+     * @var false|null|SharedEventCollection
63 63
      */
64  
-    protected $staticConnections = null;
  64
+    protected $sharedCollections = null;
65 65
 
66 66
     /**
67 67
      * Constructor
68 68
      *
69 69
      * Allows optionally specifying identifier(s) to use to pull signals from a
70  
-     * StaticEventManager.
  70
+     * SharedEventCollection.
71 71
      *
72 72
      * @param  null|string|int|array|Traversable $identifiers
73 73
      * @return void
@@ -90,32 +90,38 @@ public function setEventClass($class)
90 90
     }
91 91
 
92 92
     /**
93  
-     * Set static connections container
  93
+     * Set shared collections container
94 94
      *
95  
-     * @param  null|StaticEventCollection $connections
  95
+     * @param  SharedEventCollection $connections
96 96
      * @return void
97 97
      */
98  
-    public function setStaticConnections(StaticEventCollection $connections = null)
  98
+    public function setSharedCollections(SharedEventCollection $sharedEventCollection)
99 99
     {
100  
-        if (null === $connections) {
101  
-            $this->staticConnections = false;
102  
-        } else {
103  
-            $this->staticConnections = $connections;
104  
-        }
  100
+        $this->sharedCollections = $sharedEventCollection;
105 101
         return $this;
106 102
     }
107 103
 
108 104
     /**
109  
-     * Get static connections container
  105
+     * Remove any shared collections
  106
+     * 
  107
+     * @return void
  108
+     */
  109
+    public function unsetSharedCollections()
  110
+    {
  111
+        $this->sharedCollections = false;
  112
+    }
  113
+
  114
+    /**
  115
+     * Get shared collections container
110 116
      *
111  
-     * @return false|StaticEventCollection
  117
+     * @return false|SharedEventCollection
112 118
      */
113  
-    public function getStaticConnections()
  119
+    public function getSharedCollections()
114 120
     {
115  
-        if (null === $this->staticConnections) {
116  
-            $this->setStaticConnections(StaticEventManager::getInstance());
  121
+        if (null === $this->sharedCollections) {
  122
+            $this->setSharedCollections(StaticEventManager::getInstance());
117 123
         }
118  
-        return $this->staticConnections;
  124
+        return $this->sharedCollections;
119 125
     }
120 126
 
121 127
     /**
@@ -429,20 +435,20 @@ protected function triggerListeners($event, EventDescription $e, $callback = nul
429 435
         $responses = new ResponseCollection;
430 436
         $listeners = $this->getListeners($event);
431 437
 
432  
-        // Add static/wildcard listeners to the list of listeners,
  438
+        // Add shared/wildcard listeners to the list of listeners,
433 439
         // but don't modify the listeners object
434  
-        $staticListeners         = $this->getStaticListeners($event);
435  
-        $staticWildcardListeners = $this->getStaticListeners('*');
  440
+        $sharedListeners         = $this->getSharedListeners($event);
  441
+        $sharedWildcardListeners = $this->getSharedListeners('*');
436 442
         $wildcardListeners       = $this->getListeners('*');
437  
-        if (count($staticListeners) || count($staticWildcardListeners) || count($wildcardListeners)) {
  443
+        if (count($sharedListeners) || count($sharedWildcardListeners) || count($wildcardListeners)) {
438 444
             $listeners = clone $listeners;
439 445
         }
440 446
 
441  
-        // Static listeners on this specific event
442  
-        $this->insertListeners($listeners, $staticListeners);
  447
+        // Shared listeners on this specific event
  448
+        $this->insertListeners($listeners, $sharedListeners);
443 449
 
444  
-        // Static wildcard listeners
445  
-        $this->insertListeners($listeners, $staticWildcardListeners);
  450
+        // Shared wildcard listeners
  451
+        $this->insertListeners($listeners, $sharedWildcardListeners);
446 452
 
447 453
         // Add wildcard listeners
448 454
         $this->insertListeners($listeners, $wildcardListeners);
@@ -474,23 +480,23 @@ protected function triggerListeners($event, EventDescription $e, $callback = nul
474 480
     }
475 481
 
476 482
     /**
477  
-     * Get list of all listeners attached to the static collection for
  483
+     * Get list of all listeners attached to the shared collection for
478 484
      * identifiers registered by this instance
479 485
      *
480 486
      * @param  string $event
481 487
      * @return array
482 488
      */
483  
-    protected function getStaticListeners($event)
  489
+    protected function getSharedListeners($event)
484 490
     {
485  
-        if (!$staticConnections = $this->getStaticConnections()) {
  491
+        if (!$sharedCollections = $this->getSharedCollections()) {
486 492
             return array();
487 493
         }
488 494
 
489 495
         $identifiers     = $this->getIdentifiers();
490  
-        $staticListeners = array();
  496
+        $sharedListeners = array();
491 497
 
492 498
         foreach ($identifiers as $id) {
493  
-            if (!$listeners = $staticConnections->getListeners($id, $event)) {
  499
+            if (!$listeners = $sharedCollections->getListeners($id, $event)) {
494 500
                 continue;
495 501
             }
496 502
 
@@ -502,17 +508,17 @@ protected function getStaticListeners($event)
502 508
                 if (!$listener instanceof CallbackHandler) {
503 509
                     continue;
504 510
                 }
505  
-                $staticListeners[] = $listener;
  511
+                $sharedListeners[] = $listener;
506 512
             }
507 513
         }
508 514
 
509  
-        return $staticListeners;
  515
+        return $sharedListeners;
510 516
     }
511 517
 
512 518
     /**
513 519
      * Add listeners to the master queue of listeners
514 520
      *
515  
-     * Used to inject static listeners and wildcard listeners.
  521
+     * Used to inject shared listeners and wildcard listeners.
516 522
      * 
517 523
      * @param  PriorityQueue $masterListeners 
518 524
      * @param  PriorityQueue $listeners 
42  library/Zend/EventManager/EventManagerAware.php
... ...
@@ -0,0 +1,42 @@
  1
+<?php
  2
+/**
  3
+ * Zend Framework
  4
+ *
  5
+ * LICENSE
  6
+ *
  7
+ * This source file is subject to the new BSD license that is bundled
  8
+ * with this package in the file LICENSE.txt.
  9
+ * It is also available through the world-wide-web at this URL:
  10
+ * http://framework.zend.com/license/new-bsd
  11
+ * If you did not receive a copy of the license and are unable to
  12
+ * obtain it through the world-wide-web, please send an email
  13
+ * to license@zend.com so we can send you a copy immediately.
  14
+ *
  15
+ * @category   Zend
  16
+ * @package    Zend_EventManager
  17
+ * @subpackage UnitTest
  18
+ * @copyright  Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
  19
+ * @license    http://framework.zend.com/license/new-bsd     New BSD License
  20
+ */
  21
+
  22
+namespace Zend\EventManager;
  23
+
  24
+/**
  25
+ * Interface to automate setter injection for an EventManager instance
  26
+ *
  27
+ * @category   Zend
  28
+ * @package    Zend_EventManager
  29
+ * @subpackage UnitTest
  30
+ * @copyright  Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
  31
+ * @license    http://framework.zend.com/license/new-bsd     New BSD License
  32
+ */
  33
+interface EventManagerAware
  34
+{
  35
+    /**
  36
+     * Inject an EventManager instance
  37
+     * 
  38
+     * @param  EventCollection $eventManager 
  39
+     * @return void
  40
+     */
  41
+    public function setEventManager(EventCollection $eventManager);
  42
+}
4  library/Zend/EventManager/StaticEventCollection.php → library/Zend/EventManager/SharedEventCollection.php
@@ -21,14 +21,14 @@
21 21
 namespace Zend\EventManager;
22 22
 
23 23
 /**
24  
- * Interface for global (static) event listener collections
  24
+ * Interface for shared event listener collections
25 25
  *
26 26
  * @category   Zend
27 27
  * @package    Zend_EventManager
28 28
  * @copyright  Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
29 29
  * @license    http://framework.zend.com/license/new-bsd     New BSD License
30 30
  */
31  
-interface StaticEventCollection
  31
+interface SharedEventCollection
32 32
 {
33 33
     public function getListeners($id, $event);
34 34
 }
42  library/Zend/EventManager/SharedEventCollectionAware.php
... ...
@@ -0,0 +1,42 @@
  1
+<?php
  2
+/**
  3
+ * Zend Framework
  4
+ *
  5
+ * LICENSE
  6
+ *
  7
+ * This source file is subject to the new BSD license that is bundled
  8
+ * with this package in the file LICENSE.txt.
  9
+ * It is also available through the world-wide-web at this URL:
  10
+ * http://framework.zend.com/license/new-bsd
  11
+ * If you did not receive a copy of the license and are unable to
  12
+ * obtain it through the world-wide-web, please send an email
  13
+ * to license@zend.com so we can send you a copy immediately.
  14
+ *
  15
+ * @category   Zend
  16
+ * @package    Zend_EventManager
  17
+ * @subpackage UnitTest
  18
+ * @copyright  Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
  19
+ * @license    http://framework.zend.com/license/new-bsd     New BSD License
  20
+ */
  21
+
  22
+namespace Zend\EventManager;
  23
+
  24
+/**
  25
+ * Interface to automate setter injection for a SharedEventCollection instance
  26
+ *
  27
+ * @category   Zend
  28
+ * @package    Zend_EventManager
  29
+ * @subpackage UnitTest
  30
+ * @copyright  Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
  31
+ * @license    http://framework.zend.com/license/new-bsd     New BSD License
  32
+ */
  33
+interface SharedEventCollectionAware
  34
+{
  35
+    /**
  36
+     * Inject an EventManager instance
  37
+     * 
  38
+     * @param  SharedEventCollection $sharedEventCollection 
  39
+     * @return SharedEventCollectionAware
  40
+     */
  41
+    public function setSharedCollections(SharedEventCollection $sharedEventCollection);
  42
+}
149  library/Zend/EventManager/SharedEventManager.php
... ...
@@ -0,0 +1,149 @@
  1
+<?php
  2
+/**
  3
+ * Zend Framework
  4
+ *
  5
+ * LICENSE
  6
+ *
  7
+ * This source file is subject to the new BSD license that is bundled
  8
+ * with this package in the file LICENSE.txt.
  9
+ * It is also available through the world-wide-web at this URL:
  10
+ * http://framework.zend.com/license/new-bsd
  11
+ * If you did not receive a copy of the license and are unable to
  12
+ * obtain it through the world-wide-web, please send an email
  13
+ * to license@zend.com so we can send you a copy immediately.
  14
+ *
  15
+ * @category   Zend
  16
+ * @package    Zend_EventManager
  17
+ * @copyright  Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
  18
+ * @license    http://framework.zend.com/license/new-bsd     New BSD License
  19
+ */
  20
+
  21
+namespace Zend\EventManager;
  22
+
  23
+use Zend\Stdlib\CallbackHandler;
  24
+
  25
+/**
  26
+ * Shared/contextual EventManager
  27
+ *
  28
+ * Allows attaching to EMs composed by other classes without having an instance first.
  29
+ * The assumption is that the SharedEventManager will be injected into EventManager 
  30
+ * instances, and then queried for additional listeners when triggering an event.
  31
+ *
  32
+ * @category   Zend
  33
+ * @package    Zend_EventManager
  34
+ * @copyright  Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
  35
+ * @license    http://framework.zend.com/license/new-bsd     New BSD License
  36
+ */
  37
+class SharedEventManager implements SharedEventCollection
  38
+{
  39
+    /**
  40
+     * Identifiers with event connections
  41
+     * @var array
  42
+     */
  43
+    protected $identifiers = array();
  44
+
  45
+    /**
  46
+     * Attach a listener to an event
  47
+     *
  48
+     * Allows attaching a callback to an event offerred by one or more 
  49
+     * identifying components. As an example, the following connects to the 
  50
+     * "getAll" event of both an AbstractResource and EntityResource:
  51
+     *
  52
+     * <code>
  53
+     * SharedEventManager::getInstance()->connect(
  54
+     *     array('My\Resource\AbstractResource', 'My\Resource\EntityResource'),
  55
+     *     'getOne',
  56
+     *     function ($e) use ($cache) {
  57
+     *         if (!$id = $e->getParam('id', false)) {
  58
+     *             return;
  59
+     *         }
  60
+     *         if (!$data = $cache->load(get_class($resource) . '::getOne::' . $id )) {
  61
+     *             return;
  62
+     *         }
  63
+     *         return $data;
  64
+     *     }
  65
+     * );
  66
+     * </code>
  67
+     * 
  68
+     * @param  string|array $id Identifier(s) for event emitting component(s)
  69
+     * @param  string $event 
  70
+     * @param  callback $callback PHP Callback
  71
+     * @param  int $priority Priority at which listener should execute
  72
+     * @return void
  73
+     */
  74
+    public function attach($id, $event, $callback, $priority = 1)
  75
+    {
  76
+        $ids = (array) $id;
  77
+        foreach ($ids as $id) {
  78
+            if (!array_key_exists($id, $this->identifiers)) {
  79
+                $this->identifiers[$id] = new EventManager();
  80
+            }
  81
+            $this->identifiers[$id]->attach($event, $callback, $priority);
  82
+        }
  83
+    }
  84
+
  85
+    /**
  86
+     * Detach a listener from an event offered by a given resource
  87
+     * 
  88
+     * @param  string|int $id
  89
+     * @param  CallbackHandler $listener 
  90
+     * @return bool Returns true if event and listener found, and unsubscribed; returns false if either event or listener not found
  91
+     */
  92
+    public function detach($id, CallbackHandler $listener)
  93
+    {
  94
+        if (!array_key_exists($id, $this->identifiers)) {
  95
+            return false;
  96
+        }
  97
+        return $this->identifiers[$id]->detach($listener);
  98
+    }
  99
+
  100
+    /**
  101
+     * Retrieve all registered events for a given resource
  102
+     * 
  103
+     * @param  string|int $id
  104
+     * @return array
  105
+     */
  106
+    public function getEvents($id)
  107
+    {
  108
+        if (!array_key_exists($id, $this->identifiers)) {
  109
+            return false;
  110
+        }
  111
+        return $this->identifiers[$id]->getEvents();
  112
+    }
  113
+
  114
+    /**
  115
+     * Retrieve all listeners for a given identifier and event
  116
+     * 
  117
+     * @param  string|int $id
  118
+     * @param  string|int $event 
  119
+     * @return false|\Zend\Stdlib\PriorityQueue
  120
+     */
  121
+    public function getListeners($id, $event)
  122
+    {
  123
+        if (!array_key_exists($id, $this->identifiers)) {
  124
+            return false;
  125
+        }
  126
+        return $this->identifiers[$id]->getListeners($event);
  127
+    }
  128
+
  129
+    /**
  130
+     * Clear all listeners for a given identifier, optionally for a specific event
  131
+     * 
  132
+     * @param  string|int $id 
  133
+     * @param  null|string $event 
  134
+     * @return bool
  135
+     */
  136
+    public function clearListeners($id, $event = null)
  137
+    {
  138
+        if (!array_key_exists($id, $this->identifiers)) {
  139
+            return false;
  140
+        }
  141
+
  142
+        if (null === $event) {
  143
+            unset($this->identifiers[$id]);
  144
+            return true;
  145
+        }
  146
+
  147
+        return $this->identifiers[$id]->clearListeners($event);
  148
+    }
  149
+}
113  library/Zend/EventManager/StaticEventManager.php
@@ -30,7 +30,7 @@
30 30
  * @copyright  Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
31 31
  * @license    http://framework.zend.com/license/new-bsd     New BSD License
32 32
  */
33  
-class StaticEventManager implements StaticEventCollection
  33
+class StaticEventManager extends SharedEventManager
34 34
 {
35 35
     /**
36 36
      * @var StaticEventManager
@@ -38,12 +38,6 @@ class StaticEventManager implements StaticEventCollection
38 38
     protected static $instance;
39 39
 
40 40
     /**
41  
-     * Identifiers with event connections
42  
-     * @var array
43  
-     */
44  
-    protected $identifiers = array();
45  
-
46  
-    /**
47 41
      * Singleton
48 42
      * 
49 43
      * @return void
@@ -83,109 +77,4 @@ public static function resetInstance()
83 77
     {
84 78
         self::$instance = null;
85 79
     }
86  
-
87  
-    /**
88  
-     * Attach a listener to an event
89  
-     *
90  
-     * Allows attaching a callback to an event offerred by one or more 
91  
-     * identifying components. As an example, the following connects to the 
92  
-     * "getAll" event of both an AbstractResource and EntityResource:
93  
-     *
94  
-     * <code>
95  
-     * StaticEventManager::getInstance()->connect(
96  
-     *     array('My\Resource\AbstractResource', 'My\Resource\EntityResource'),
97  
-     *     'getOne',
98  
-     *     function ($e) use ($cache) {
99  
-     *         if (!$id = $e->getParam('id', false)) {
100  
-     *             return;
101  
-     *         }
102  
-     *         if (!$data = $cache->load(get_class($resource) . '::getOne::' . $id )) {
103  
-     *             return;
104  
-     *         }
105  
-     *         return $data;
106  
-     *     }
107  
-     * );
108  
-     * </code>
109  
-     * 
110  
-     * @param  string|array $id Identifier(s) for event emitting component(s)
111  
-     * @param  string $event 
112  
-     * @param  callback $callback PHP Callback
113  
-     * @param  int $priority Priority at which listener should execute
114  
-     * @return void
115  
-     */
116  
-    public function attach($id, $event, $callback, $priority = 1)
117  
-    {
118  
-        $ids = (array) $id;
119  
-        foreach ($ids as $id) {
120  
-            if (!array_key_exists($id, $this->identifiers)) {
121  
-                $this->identifiers[$id] = new EventManager();
122  
-            }
123  
-            $this->identifiers[$id]->attach($event, $callback, $priority);
124  
-        }
125  
-    }
126  
-
127  
-    /**
128  
-     * Detach a listener from an event offered by a given resource
129  
-     * 
130  
-     * @param  string|int $id
131  
-     * @param  CallbackHandler $listener 
132  
-     * @return bool Returns true if event and listener found, and unsubscribed; returns false if either event or listener not found
133  
-     */
134  
-    public function detach($id, CallbackHandler $listener)
135  
-    {
136  
-        if (!array_key_exists($id, $this->identifiers)) {
137  
-            return false;
138  
-        }
139  
-        return $this->identifiers[$id]->detach($listener);
140  
-    }
141  
-
142  
-    /**
143  
-     * Retrieve all registered events for a given resource
144  
-     * 
145  
-     * @param  string|int $id
146  
-     * @return array
147  
-     */
148  
-    public function getEvents($id)
149  
-    {
150  
-        if (!array_key_exists($id, $this->identifiers)) {
151  
-            return false;
152  
-        }
153  
-        return $this->identifiers[$id]->getEvents();
154  
-    }
155  
-
156  
-    /**
157  
-     * Retrieve all listeners for a given identifier and event
158  
-     * 
159  
-     * @param  string|int $id
160  
-     * @param  string|int $event 
161  
-     * @return false|\Zend\Stdlib\PriorityQueue
162  
-     */
163  
-    public function getListeners($id, $event)
164  
-    {
165  
-        if (!array_key_exists($id, $this->identifiers)) {
166  
-            return false;
167  
-        }
168  
-        return $this->identifiers[$id]->getListeners($event);
169  
-    }
170  
-
171  
-    /**
172  
-     * Clear all listeners for a given identifier, optionally for a specific event
173  
-     * 
174  
-     * @param  string|int $id 
175  
-     * @param  null|string $event 
176  
-     * @return bool
177  
-     */
178  
-    public function clearListeners($id, $event = null)
179  
-    {
180  
-        if (!array_key_exists($id, $this->identifiers)) {
181  
-            return false;
182  
-        }
183  
-
184  
-        if (null === $event) {
185  
-            unset($this->identifiers[$id]);
186  
-            return true;
187  
-        }
188  
-
189  
-        return $this->identifiers[$id]->clearListeners($event);
190  
-    }
191 80
 }
12  library/Zend/Module/ModuleHandler.php
@@ -2,9 +2,9 @@
2 2
 
3 3
 namespace Zend\Module;
4 4
 
5  
-use Zend\EventManager\EventCollection;
  5
+use Zend\EventManager\EventManagerAware;
6 6
 
7  
-interface ModuleHandler
  7
+interface ModuleHandler extends EventManagerAware
8 8
 {
9 9
     /**
10 10
      * Load the provided modules.
@@ -45,14 +45,6 @@ public function getModules();
45 45
     public function setModules($modules);
46 46
 
47 47
     /**
48  
-     * Set the event manager instance used by this module manager.
49  
-     *
50  
-     * @param  EventCollection $events
51  
-     * @return ModuleHandler
52  
-     */
53  
-    public function setEventManager(EventCollection $events);
54  
-
55  
-    /**
56 48
      * Retrieve the event manager
57 49
      *
58 50
      * Lazy-loads an EventManager instance if none registered.
12  library/Zend/Mvc/AppContext.php
@@ -3,21 +3,13 @@
3 3
 namespace Zend\Mvc;
4 4
 
5 5
 use Zend\Di\Locator,
6  
-    Zend\EventManager\EventCollection,
  6
+    Zend\EventManager\EventManagerAware,
7 7
     Zend\Stdlib\RequestDescription as Request,
8 8
     Zend\Stdlib\ResponseDescription as Response;
9 9
 
10  
-interface AppContext
  10
+interface AppContext extends EventManagerAware
11 11
 {
12 12
     /**
13  
-     * Set the event manager instance used by this context
14  
-     * 
15  
-     * @param  EventCollection $events 
16  
-     * @return AppContext
17  
-     */
18  
-    public function setEventManager(EventCollection $events);
19  
-
20  
-    /**
21 13
      * Set a service locator/DI object
22 14
      *
23 15
      * @param  Locator $locator 
15  library/Zend/Mvc/Bootstrap.php
@@ -6,10 +6,11 @@
6 6
     Zend\Config\Config,
7 7
     Zend\EventManager\EventCollection as Events,
8 8
     Zend\EventManager\EventManager,
  9
+    Zend\EventManager\EventManagerAware,
9 10
     Zend\EventManager\StaticEventManager,
10 11
     Zend\Mvc\Router\Http\TreeRouteStack as Router;
11 12
 
12  
-class Bootstrap implements Bootstrapper
  13
+class Bootstrap implements Bootstrapper, EventManagerAware
13 14
 {
14 15
     /**
15 16
      * @var \Zend\Config\Config
@@ -217,7 +218,17 @@ protected function setupLocator(AppContext $application)
217 218
                     ),
218 219
                 ),
219 220
             ),