src/Application/Messaging/Event/ServiceAwareEventDispatcher.php
protected function lazyLoad(string $eventType): void
    {
        if (isset($this->serviceIds[$eventType])) {
            foreach ($this->serviceIds[$eventType] as $args) {
                list($serviceId, $method, $priority) = $args;
                $service = $this->container->get($serviceId);
                $key = sprintf('%s.%s', $serviceId, $method);
                if (!isset($this->services[$eventType][$key])) {
                    $this->addHandler($eventType, [$service, $method], $priority);
                } elseif ($service !== $this->services[$eventType][$key]) {
                    parent::removeHandler($eventType, [$this->services[$eventType][$key], $method]);
                    $this->addHandler($eventType, [$service, $method], $priority);
                }
                $this->services[$eventType][$key] = $service;
            }
        }
    }
protected function lazyLoad(string $eventType): void
    {
        if (isset($this->serviceIds[$eventType])) {
            foreach ($this->serviceIds[$eventType] as $args) {
                list($serviceId, $method, $priority) = $args;
                $service = $this->container->get($serviceId);
                $key = sprintf('%s.%s', $serviceId, $method);
                if (!isset($this->services[$eventType][$key])) {
                    $this->addHandler($eventType, [$service, $method], $priority);
                } elseif ($service !== $this->services[$eventType][$key]) {
                    parent::removeHandler($eventType, [$this->services[$eventType][$key], $method]);
                    $this->addHandler($eventType, [$service, $method], $priority);
                }
                $this->services[$eventType][$key] = $service;
            }
        }
    }
protected function lazyLoad ( string $ eventType ) : void { if ( isset ( $ this -> serviceIds [ $ eventType ] ) ) { foreach ( $ this -> serviceIds [ $ eventType ] as $ args ) { list ( $ serviceId , $ method , $ priority ) = $ args ; $ service = $ this -> container -> get ( $ serviceId ) ; $ key = sprintf ( '%s.%s' , $ serviceId , $ method ) ; if ( ! isset ( $ this -> services [ $ eventType ] [ $ key ] ) ) { $ this -> addHandler ( $ eventType , [ $ service , $ method ] , $ priority ) ; } elseif ( $ service !== $ this -> services [ $ eventType ] [ $ key ] ) { parent :: removeHandler ( $ eventType , [ $ this -> services [ $ eventType ] [ $ key ] , $ method ] ) ; $ this -> addHandler ( $ eventType , [ $ service , $ method ] , $ priority ) ; } $ this -> services [ $ eventType ] [ $ key ] = $ service ; } } }
Lazy loads event handlers from the service container

@param string $eventType The event type

@return void
Lazy loads event handlers from the service container