Permalink
Browse files

[#3084] Split new interface methods into separate interface

- To prevent a BC break (uncovered by running the unit tests), moved new
  attachAggregate() and detachAggregate() methods into a separate interface; the
  SharedEventManager implementation now also implements this new interface.
  • Loading branch information...
1 parent 4d0d275 commit a181500e4d9a5f70612e0b7e68e3c57683564e79 @weierophinney weierophinney committed Dec 11, 2012
@@ -0,0 +1,38 @@
+<?php
+/**
+ * Zend Framework (http://framework.zend.com/)
+ *
+ * @link http://github.com/zendframework/zf2 for the canonical source repository
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ * @package Zend_EventManager
+ */
+
+namespace Zend\EventManager;
+
+
+/**
+ * Interface for allowing attachment of shared aggregate listeners.
+ *
+ * @category Zend
+ * @package Zend_EventManager
+ */
+interface SharedEventAggregateAwareInterface
+{
+ /**
+ * Attach a listener aggregate
+ *
+ * @param SharedListenerAggregateInterface $aggregate
+ * @param int $priority If provided, a suggested priority for the aggregate to use
+ * @return mixed return value of {@link SharedListenerAggregateInterface::attachShared()}
+ */
+ public function attachAggregate(SharedListenerAggregateInterface $aggregate, $priority = 1);
+
+ /**
+ * Detach a listener aggregate
+ *
+ * @param SharedListenerAggregateInterface $aggregate
+ * @return mixed return value of {@link SharedListenerAggregateInterface::detachShared()}
+ */
+ public function detachAggregate(SharedListenerAggregateInterface $aggregate);
+}
@@ -23,7 +23,9 @@
* @category Zend
* @package Zend_EventManager
*/
-class SharedEventManager implements SharedEventManagerInterface
+class SharedEventManager implements
+ SharedEventAggregateAwareInterface,
+ SharedEventManagerInterface
{
/**
* Identifiers with event connections
@@ -66,22 +66,4 @@ public function getEvents($id);
* @return bool
*/
public function clearListeners($id, $event = null);
-
- /**
- * Attach a listener aggregate
- *
- * @param SharedListenerAggregateInterface $aggregate
- * @param int $priority If provided, a suggested priority for the aggregate to use
- * @return mixed return value of {@link SharedListenerAggregateInterface::attachShared()}
- */
- public function attachAggregate(SharedListenerAggregateInterface $aggregate, $priority = 1);
-
- /**
- * Detach a listener aggregate
- *
- * @param SharedListenerAggregateInterface $aggregate
- * @return mixed return value of {@link SharedListenerAggregateInterface::detachShared()}
- */
- public function detachAggregate(SharedListenerAggregateInterface $aggregate);
-
}

0 comments on commit a181500

Please sign in to comment.