src/Controller/Component/CrudComponent.php
protected function _loadListener($name)
    {
        if (!isset($this->_listenerInstances[$name])) {
            $config = $this->getConfig('listeners.' . $name);

            if (empty($config)) {
                throw new ListenerNotConfiguredException(sprintf('Listener "%s" is not configured', $name));
            }

            $className = App::className($config['className'], 'Listener', 'Listener');
            if (empty($className)) {
                throw new MissingListenerException('Could not find listener class: ' . $config['className']);
            }

            $this->_listenerInstances[$name] = new $className($this->_controller);
            unset($config['className']);
            $this->_listenerInstances[$name]->setConfig($config);

            $this->_eventManager->on($this->_listenerInstances[$name]);

            if (is_callable([$this->_listenerInstances[$name], 'setup'])) {
                $this->_listenerInstances[$name]->setup();
            }
        }

        return $this->_listenerInstances[$name];
    }
protected function _loadListener($name)
    {
        if (!isset($this->_listenerInstances[$name])) {
            $config = $this->getConfig('listeners.' . $name);

            if (empty($config)) {
                throw new ListenerNotConfiguredException(sprintf('Listener "%s" is not configured', $name));
            }

            $className = App::className($config['className'], 'Listener', 'Listener');
            if (empty($className)) {
                throw new MissingListenerException('Could not find listener class: ' . $config['className']);
            }

            $this->_listenerInstances[$name] = new $className($this->_controller);
            unset($config['className']);
            $this->_listenerInstances[$name]->setConfig($config);

            $this->_eventManager->on($this->_listenerInstances[$name]);

            if (is_callable([$this->_listenerInstances[$name], 'setup'])) {
                $this->_listenerInstances[$name]->setup();
            }
        }

        return $this->_listenerInstances[$name];
    }
protected function _loadListener ( $ name ) { if ( ! isset ( $ this -> _listenerInstances [ $ name ] ) ) { $ config = $ this -> getConfig ( 'listeners.' . $ name ) ; if ( empty ( $ config ) ) { throw new ListenerNotConfiguredException ( sprintf ( 'Listener "%s" is not configured' , $ name ) ) ; } $ className = App :: className ( $ config [ 'className' ] , 'Listener' , 'Listener' ) ; if ( empty ( $ className ) ) { throw new MissingListenerException ( 'Could not find listener class: ' . $ config [ 'className' ] ) ; } $ this -> _listenerInstances [ $ name ] = new $ className ( $ this -> _controller ) ; unset ( $ config [ 'className' ] ) ; $ this -> _listenerInstances [ $ name ] -> setConfig ( $ config ) ; $ this -> _eventManager -> on ( $ this -> _listenerInstances [ $ name ] ) ; if ( is_callable ( [ $ this -> _listenerInstances [ $ name ] , 'setup' ] ) ) { $ this -> _listenerInstances [ $ name ] -> setup ( ) ; } } return $ this -> _listenerInstances [ $ name ] ; }
Load a single event class attached to Crud.

@param string $name Name
@return \Crud\Listener\BaseListener
@throws \Crud\Error\Exception\ListenerNotConfiguredException
@throws \Crud\Error\Exception\MissingListenerException
Load a single event class attached to Crud .