zend-eventmanager icon indicating copy to clipboard operation
zend-eventmanager copied to clipboard

Should there be a SharedLazyListenerAggregate?

Open davidwindell opened this issue 7 years ago • 3 comments

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

davidwindell avatar Mar 15 '17 14:03 davidwindell

What would a lazy listener do?

Ocramius avatar Mar 15 '17 15:03 Ocramius

@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.

davidwindell avatar Mar 15 '17 15:03 davidwindell

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.

weierophinney avatar Dec 31 '19 21:12 weierophinney