zend-eventmanager
zend-eventmanager copied to clipboard
Should there be a SharedLazyListenerAggregate?
Is there a reason there isn't a Lazy Aggregate for attaching listeners to the Shared Event Manager?
Something like:
class SharedLazyListenerAggregate
{
...
public function attachShared(SharedEventManagerInterface $manager, $priority = 1)
{
foreach ($this->lazyListeners as $lazyListener) {
$this->listeners[] = $manager->attach(
'*',
$lazyListener->getEvent(),
$lazyListener,
$lazyListener->getPriority($priority)
);
}
}
Ping @bakura10
What would a lazy listener do?
@Ocramius this would effectively be the same as the existing LazyListenerAggregate (https://github.com/zendframework/zend-eventmanager/blob/master/src/LazyListenerAggregate.php) but allow attaching to the Shared Event Manager.
This repository has been closed and moved to laminas/laminas-eventmanager; a new issue has been opened at https://github.com/laminas/laminas-eventmanager/issues/6.