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

Commit

Permalink
[#3084] Split new interface methods into separate interface
Browse files Browse the repository at this point in the history
- 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
weierophinney committed Dec 11, 2012
1 parent 4d0d275 commit a181500
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 19 deletions.
38 changes: 38 additions & 0 deletions library/Zend/EventManager/SharedEventAggregateAwareInterface.php
Original file line number Diff line number Diff line change
@@ -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);
}
4 changes: 3 additions & 1 deletion library/Zend/EventManager/SharedEventManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@
* @category Zend
* @package Zend_EventManager
*/
class SharedEventManager implements SharedEventManagerInterface
class SharedEventManager implements
SharedEventAggregateAwareInterface,
SharedEventManagerInterface
{
/**
* Identifiers with event connections
Expand Down
18 changes: 0 additions & 18 deletions library/Zend/EventManager/SharedEventManagerInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.