{@inheritdoc}
@see \Zend\EventManager\ListenerAggregateInterface::attach()
198161
public function attach(EventManagerInterface $events)
    {
        $eventConfigListener = new modules\EventConfigModuleListener($this->serviceLocator);

        $this->listeners[] = $events->attach(ModuleEvent::EVENT_LOAD_MODULES_POST, $eventConfigListener);
        $this->listeners[] = $events->attach(ModuleEvent::EVENT_LOAD_MODULE_RESOLVE, array($this, 'resolve'), 100);

        return $this;
    }
698243
private function bindEventListenersEvents()
	{
		if ($this->_eventListeners && !$this->_listenerInstances) {
			foreach ($this->_eventListeners as $listener) {
                
				$listener = static::getListener($listener);
				
				$events = $listener->events();
				
				if ($events) foreach ($events as $name => $handler) {
					static::on($name, is_string($handler) ? [$listener, $handler] : $handler);
				}
			}
		}
	}
1169608
public function attach(EventManagerInterface $events)
    {
        $this->listeners[] = $events->attach(
            MvcEvent::EVENT_RENDER,
            [$this, 'renderLayoutSegments'],
            -100
        );
    }
1068783
public function attach(EventManagerInterface $events, $priority = 1)
    {
        $this->listeners[] = $events->attach(ViewEvent::EVENT_RENDERER, array($this, 'selectRenderer'), $priority);
        $this->listeners[] = $events->attach(ViewEvent::EVENT_RESPONSE, array($this, 'injectResponse'), $priority);
    }
1091197
public function attach(EventManagerInterface $events)
    {
        $sharedEvents = $events->getSharedManager();
        
        // check for 403 at beginning of route and dispatch events
        $this->listeners[] = $events->attach(
            array(MvcEvent::EVENT_ROUTE, MvcEvent::EVENT_DISPATCH),
            array($this, 'detectAccessDenied'),
            1000);

        // check for 403 immediately after controller dispatch
        $this->listeners[] = $sharedEvents->attach(
            'Zend\Stdlib\DispatchableInterface',
            MvcEvent::EVENT_DISPATCH,
            array($this, 'detectAccessDenied'),
            0);
        
        // inject access denied view model
        $this->listeners[] = $events->attach(
            MvcEvent::EVENT_RENDER, 
            array($this, 'injectAccessDeniedViewModel'), 
            1);
    }
153883
function createAttach() {
    $cnt = count( $this->attach );
    if( 0 >= $cnt )
      return;
    $output    = null;
    foreach( $this->attach as $attachPart ) {
      $attributes = $this->_createParams( $attachPart['params'] );
      $output    .= $this->_createElement( 'ATTACH', $attributes, $attachPart['value'] );
    }
    return $output;
  }
1023340
public function attach(EventManagerInterface $events)
    {
        $events->attach(
            MvcEvent::EVENT_RENDER,
            function (MvcEvent $event) {
                /** @var ServiceManager $serviceManager */
                $serviceManager = $event->getTarget()->getServiceManager();
                /** @var ControllerManager $controllerManager */
                $controllerManager = $serviceManager->get('ControllerManager');
                $routeMatch = $event->getRouteMatch();
                if ($routeMatch) {
                    $controller = $controllerManager->get($routeMatch->getParam('controller'));
                    $viewHelperManager = $serviceManager->get('ViewHelperManager');
                    /** @var Widget $widgetViewHelper */
                    $widgetViewHelper = $viewHelperManager->get('widget');
                    $widgetViewHelper->setController($controller);
                }
            },
            $this->priority
        );
    }
100931
public function attach(EventManagerInterface $events)
    {
        $this->listeners[] = $events->attach(MvcEvent::EVENT_RENDER, array($this, 'render'), 100);
        $this->listeners[] = $events->attach(MvcEvent::EVENT_RENDER_ERROR, array($this, 'render'), 100);
    }
921190
protected function attachEvent(EventManagerInterface $events, $id, $event, $callback)
    {
        /** @var \Zend\EventManager\SharedEventManager $sharedEvents */
        $sharedEvents = $events->getSharedManager();

        $this->listeners[] = $sharedEvents->attach($id, $event, array($this, $callback), 100);
    }
1273295
public function AttachObserver($listener)
	{
		if ($listener) {
			$this->_observers[] =& $listener;
			if ($this->_masterAdapter) $this->_masterAdapter->AttachObserver($listener);
		}
		
	}
646895
public function attach(ObserverInterface $observer)
    {
        $observers = $this->getObservers();

        foreach ($observer->getEvents() as $event) {
            $observers[$event][] = $observer;
        }

        $this->setObservers($observers);
    }
64290
public function attach($eventName, callable $handler, $priority = 0)
    {
        if (is_array($eventName)) {
            foreach ($eventName as $name) {
                $this->attach($name, $handler, $priority);
            }
            return;
        }
        if (!is_string($eventName)) {
            throw new InvalidArgumentException(sprintf(
                '%s expects argument 1 to be string; %s given.',
                __METHOD__,
                is_object($eventName) ? get_class($eventName) : gettype($eventName)
            ));
        }

        if (!array_key_exists($eventName, $this->events)) {
            $this->events[$eventName] = new CallbackQueue();
        }

        $this->events[$eventName]->add($handler, $priority);
    }
495330
public function attach(EventManagerInterface $events, $priority = 1000)
    {
        if (PHP_SAPI === 'cli') {
            return;
        }

        $this->listeners[] = $events->getSharedManager()->attach(
            Application::class,
            MvcEvent::EVENT_ROUTE,
            [
                $this,
                'onRouteRemoveTrailingSlash'
            ],
            $priority
        );

        $this->listeners[] = $events->getSharedManager()->attach(
            Application::class,
            MvcEvent::EVENT_ROUTE,
            [
                $this,
                'onRouteNormalizeParameters'
            ],
            -$priority
        );
    }
846844
public function attach(EventManagerInterface $events)
    {
        $this->listeners[] = $events->attach(MvcEvent::EVENT_DISPATCH, 
            array(
                $this,
                'injectPlugin'
            ), 100);
        $this->listeners[] = $events->attach(MvcEvent::EVENT_FINISH, 
            array(
                $this,
                'storeRoute'
            ), - 100);
    }
31169
public function attachByScope(CakeEventListener $subscriber, $manager = null, $scope = null) {
		if (!($manager instanceof CakeEventManager)) {
			$scope = $manager;
			$_this = $this;
		} else {
			$_this = $manager;
		}

		if (empty($scope)) {
			$_this->attach($subscriber);
			return;
		}

		foreach ($subscriber->implementedEvents() as $eventKey => $function) {
			if (strpos($eventKey, $scope) !== 0) {
				continue;
			}

			$options = array();
			$method = $function;
			if (is_array($function) && isset($function['callable'])) {
				list($method, $options) = $_this->_extractCallable($function, $subscriber);
			} elseif (is_array($function) && is_numeric(key($function))) {
				foreach ($function as $f) {
					list($method, $options) = $_this->_extractCallable($f, $subscriber);
					$_this->attach($method, $eventKey, $options);
				}
				continue;
			}
			if (is_string($method)) {
				$method = array($subscriber, $function);
			}
			$_this->attach($method, $eventKey, $options);
		}
	}
1315535
public function attachEvents()
    {
        $appEvents = $this->container->get('event')->getAppEvents();

        if (!empty($appEvents)) {
            foreach ($appEvents as $event => $namespace) {
                // attach all before and after event to handler
                $this->container->get('event')->attach("$event", $namespace);
            }
        }
    }
573996
public function attach(EventManagerInterface $events, $priority = 1)
    {
        $events->attach(PageEvent::EVENT_ADD_PRE, [$this, 'setStandardParams']);
        $events->attach(PageEvent::EVENT_EDIT_PRE, [$this, 'setStandardParams']);
        $events->attach(PageEvent::EVENT_APPROVED, [$this, 'setStandardParams']);

        $events->attach(PageEvent::EVENT_ADD_PRE, [$this, 'setSlug']);
        $events->attach(PageEvent::EVENT_EDIT_PRE, [$this, 'setSlug']);
        $events->attach(PageEvent::EVENT_APPROVED, [$this, 'setSlug']);

        $events->attach(PageEvent::EVENT_APPROVED, [$this, 'saveNavigation']);

        $events->attach(PageEvent::EVENT_APPROVED, [$this, 'updateCache']);
    }