public function createService(ServiceLocatorInterface $serviceLocator)
    {
        if (!$serviceLocator->has('ServiceListener')) {
            $serviceLocator->setFactory('ServiceListener', 'PPI\Framework\ServiceManager\Factory\ServiceListenerFactory');
        }

        $config           = $serviceLocator->get('ApplicationConfig');
        $defaultListeners = $serviceLocator->get('ModuleDefaultListener');
        $serviceListener  = $serviceLocator->get('ServiceListener');

        $serviceListener->addServiceManager(
            $serviceLocator,
            'service_manager',
            'Zend\ModuleManager\Feature\ServiceProviderInterface',
            'getServiceConfig'
        );
        $serviceListener->addServiceManager(
            'RoutePluginManager',
            'route_manager',
            'Zend\ModuleManager\Feature\RouteProviderInterface',
            'getRouteConfig'
        );

        $modules = isset($config['modules']) ? $config['modules'] : array();

        $events = $serviceLocator->get('EventManager');
        $events->attach($defaultListeners);
        $events->attach($serviceListener);

        $moduleEvent = new ModuleEvent();
        $moduleEvent->setParam('ServiceManager', $serviceLocator);

        $moduleManager = new ModuleManager($modules, $events);
        $moduleManager->setEvent($moduleEvent);

        return $moduleManager;
    }
public function createService(ServiceLocatorInterface $serviceLocator)
    {
        if (!$serviceLocator->has('ServiceListener')) {
            $serviceLocator->setFactory('ServiceListener', 'PPI\Framework\ServiceManager\Factory\ServiceListenerFactory');
        }

        $config           = $serviceLocator->get('ApplicationConfig');
        $defaultListeners = $serviceLocator->get('ModuleDefaultListener');
        $serviceListener  = $serviceLocator->get('ServiceListener');

        $serviceListener->addServiceManager(
            $serviceLocator,
            'service_manager',
            'Zend\ModuleManager\Feature\ServiceProviderInterface',
            'getServiceConfig'
        );
        $serviceListener->addServiceManager(
            'RoutePluginManager',
            'route_manager',
            'Zend\ModuleManager\Feature\RouteProviderInterface',
            'getRouteConfig'
        );

        $modules = isset($config['modules']) ? $config['modules'] : array();

        $events = $serviceLocator->get('EventManager');
        $events->attach($defaultListeners);
        $events->attach($serviceListener);

        $moduleEvent = new ModuleEvent();
        $moduleEvent->setParam('ServiceManager', $serviceLocator);

        $moduleManager = new ModuleManager($modules, $events);
        $moduleManager->setEvent($moduleEvent);

        return $moduleManager;
    }
public function createService ( ServiceLocatorInterface $ serviceLocator ) { if ( ! $ serviceLocator -> has ( 'ServiceListener' ) ) { $ serviceLocator -> setFactory ( 'ServiceListener' , 'PPI\Framework\ServiceManager\Factory\ServiceListenerFactory' ) ; } $ config = $ serviceLocator -> get ( 'ApplicationConfig' ) ; $ defaultListeners = $ serviceLocator -> get ( 'ModuleDefaultListener' ) ; $ serviceListener = $ serviceLocator -> get ( 'ServiceListener' ) ; $ serviceListener -> addServiceManager ( $ serviceLocator , 'service_manager' , 'Zend\ModuleManager\Feature\ServiceProviderInterface' , 'getServiceConfig' ) ; $ serviceListener -> addServiceManager ( 'RoutePluginManager' , 'route_manager' , 'Zend\ModuleManager\Feature\RouteProviderInterface' , 'getRouteConfig' ) ; $ modules = isset ( $ config [ 'modules' ] ) ? $ config [ 'modules' ] : array ( ) ; $ events = $ serviceLocator -> get ( 'EventManager' ) ; $ events -> attach ( $ defaultListeners ) ; $ events -> attach ( $ serviceListener ) ; $ moduleEvent = new ModuleEvent ( ) ; $ moduleEvent -> setParam ( 'ServiceManager' , $ serviceLocator ) ; $ moduleManager = new ModuleManager ( $ modules , $ events ) ; $ moduleManager -> setEvent ( $ moduleEvent ) ; return $ moduleManager ; }
Creates and returns the module manager.

Instantiates the default module listeners, providing them configuration
from the "module_listener_options" key of the ApplicationConfig
service. Also sets the default config glob path.

Module manager is instantiated and provided with an EventManager, to which
the default listener aggregate is attached. The ModuleEvent is also created
and attached to the module manager.

@param ServiceLocatorInterface $serviceLocator

@return ModuleManager
Creates and returns the module manager .