This method is called only when the config is not cached.
@param \Zend\ModuleManager\ModuleEvent $e
519091
public function onMergeConfig(\Zend\ModuleManager\ModuleEvent $e)
    {
        $config = $e->getConfigListener()->getMergedConfig(false);

        if (isset($config['design']) && isset($config['design']['frontend'])) {
            $parentTheme = array($config['design']['frontend']['package'], $config['design']['frontend']['theme']);
        } else {
            $parentTheme = array('playground', 'base');
        }

        // If custom games need a specific route. I create these routes
        if (PHP_SAPI !== 'cli') {
            $configDatabaseDoctrine = $config['doctrine']['connection']['orm_default']['params'];
            $configDatabase = array('driver' => 'Mysqli',
                'database' => $configDatabaseDoctrine['dbname'],
                'username' => $configDatabaseDoctrine['user'],
                'password' => $configDatabaseDoctrine['password'],
                'hostname' => $configDatabaseDoctrine['host']);

            if (!empty($configDatabaseDoctrine['port'])) {
                $configDatabase['port'] = $configDatabaseDoctrine['port'];
            }
            if (!empty($configDatabaseDoctrine['charset'])) {
                $configDatabase['charset'] = $configDatabaseDoctrine['charset'];
            }

            $adapter = new Adapter($configDatabase);
            $sql = new Sql($adapter);
    
            // ******************************************
            // Check if games with specific domains have been configured
            // ******************************************
            $select = $sql->select();
            $select->from('game');
            $select->where(array('active' => 1, 'domain IS NOT NULL', "domain != ''"));
            $statement = $sql->prepareStatementForSqlObject($select);
            $results = $statement->execute();
            foreach ($results as $result) {
                $config['custom_games'][$result['identifier']] = [
                    'url' => $result['domain'],
                    'classType' => $result['class_type']
                ];
            }

            if (isset($config['custom_games'])) {
                foreach ($config['custom_games'] as $k => $v) {
                    // add custom language directory
                    $config['translator']['translation_file_patterns'][] = array(
                        'type'     => 'phpArray',
                        'base_dir' => __DIR__ .'/../../../../design/frontend/'.$parentTheme[0].
                        '/'.$parentTheme[1].'/custom/'.$k.'/language',
                        'pattern'     => '%s.php',
                        'text_domain' => $k,
                    );

                    // create routes
                    if (isset($v['url'])) {
                        if (!is_array($v['url'])) {
                            $v['url'] = array($v['url']);
                        }
                        foreach ($v['url'] as $url) {
                            // I take the url model of the game type
                            if (isset($config['router']['routes']['frontend']['child_routes'][$v['classType']])) {
                                $routeModel = $config['router']['routes']['frontend']['child_routes'][$v['classType']];

                                // Changing the root of the route
                                $routeModel['options']['route'] = '/';

                                // and removing the trailing slash for each subsequent route
                                foreach ($routeModel['child_routes'] as $id => $ar) {
                                    if (isset($routeModel['child_routes'][$id]['options']['route'])) {
                                        $routeModel['child_routes'][$id]['options']['route'] = ltrim(
                                            $ar['options']['route'],
                                            '/'
                                        );
                                    }
                                }

                                // then create the hostname route + appending the model updated
                                $config['router']['routes']['frontend.'.$url] = array(
                                    'type'      => 'Zend\Router\Http\Hostname',
                                    'options'   => array(
                                        'route'    => $url,
                                        'defaults' => array(
                                            'id'      => $k,
                                        )
                                    ),
                                    'may_terminate' => true
                                );
                                $config['router']['routes']['frontend.'.$url]['child_routes'][$v['classType']] = $routeModel;
                                // print_r($config['router']['routes']['frontend.'.$url]);
                                // die('o');
                                $coreLayoutModel = isset($config['core_layout']['frontend'])?
                                $config['core_layout']['frontend']:
                                [];
                                $config['core_layout']['frontend.'.$url] = $coreLayoutModel;
                            }
                        }
                    }
                }
            }
        }

        $e->getConfigListener()->setMergedConfig($config);
    }
1310703
public function onBootstrap(MvcEvent $e)
    {
        // we attach with wildcard events name
        $events = $e->getApplication()->getEventManager();
        $events->attach(
            MvcEvent::EVENT_RENDER,
            new InjectSubNavigationListener(),
            10
        );
    }
871553
public function onBuildKernel(PreBuildKernelEvent $event): void
    {
        $injectedSettings = $this->configResolver->getParameter('injected_settings', 'netgen_site_legacy');
        $injectedMergeSettings = $this->configResolver->getParameter('injected_merge_settings', 'netgen_site_legacy');

        $formattedInjectedSettings = [];
        $formattedInjectedMergeSettings = [];

        foreach ($injectedSettings as $legacyIniName => $legacyIniConfig) {
            if (!is_array($legacyIniConfig) || empty($legacyIniConfig)) {
                continue;
            }

            foreach ($legacyIniConfig as $legacyIniValueName => $legacyIniValue) {
                if (!is_string($legacyIniValueName)) {
                    continue;
                }

                $formattedInjectedSettings[$legacyIniName . '/' . $legacyIniValueName] = $legacyIniValue;
            }
        }

        foreach ($injectedMergeSettings as $legacyIniName => $legacyIniConfig) {
            if (!is_array($legacyIniConfig) || empty($legacyIniConfig)) {
                continue;
            }

            foreach ($injectedMergeSettings[$legacyIniName] as $legacyIniValueName => $legacyIniValue) {
                if (!is_string($legacyIniValueName) || !is_array($legacyIniValue)) {
                    continue;
                }

                $formattedInjectedMergeSettings[$legacyIniName . '/' . $legacyIniValueName] = $legacyIniValue;
            }
        }

        $event->getParameters()->set(
            'injected-settings',
            $formattedInjectedSettings + (array) $event->getParameters()->get('injected-settings')
        );

        $event->getParameters()->set(
            'injected-merge-settings',
            $formattedInjectedMergeSettings + (array) $event->getParameters()->get('injected-merge-settings')
        );
    }
149415
public function _before(TestInterface $test)
    {
        if (class_exists('\Memcache')) {
            $this->memcache = new \Memcache;
            $this->memcache->connect($this->config['host'], $this->config['port']);
        } elseif (class_exists('\Memcached')) {
            $this->memcache = new \Memcached;
            $this->memcache->addServer($this->config['host'], $this->config['port']);
        } else {
            throw new ModuleConfigException(__CLASS__, 'Memcache classes not loaded');
        }
    }
1232875
public function onBootstrap(EventInterface $e)
	{
        /** @var $app \Zend\Mvc\Application */
        $app    = $e->getTarget();
        $events = $app->getEventManager();
        $sm     = $app->getServiceManager();

        // register each permission's guard to event manager
        $permsManager = $sm->get('yimaAuthorize.AuthServiceManager');
        if (!$permsManager instanceof AuthServiceManager)
            throw new \Exception(sprintf(
                'Invalid Permission Manager, It must be instance of "%s" but "%s" given.'
                , 'PermissionManager'
                , get_class($permsManager)
            ));

        foreach ($permsManager->getRegisteredServices() as $services) {
            if (is_array($services))
                foreach ($services as $prm) {
                    /** @var $prm AuthServiceInterface */
                    $prm   = $permsManager->get($prm);
                    if ($prm instanceof MvcAuthServiceInterface) {
                        /** @var $prm MvcAuthServiceInterface */
                        $guard = $prm->getGuard();
                        if ($guard && $guard instanceof GuardInterface)
                            $events->attach($guard);
                    }
                }
        }
	}
347354
private function dispatchEvent($em, $event)
    {
        $eventArgs = new LifecycleEventArgs(null, $em);

        $em->getEventManager()
           ->dispatchEvent($event, $eventArgs);
    }
708910
public void onApplicationEvent(ApplicationEvent e) {
		if (e instanceof LifecycleApplicationEvent) {
			LifecycleApplicationEvent le = (LifecycleApplicationEvent) e;
			if (shouldHandleEvent(e)) {
				if (le.getEventType() == LifecycleApplicationEvent.CREATED) {
					handleNewObject(le.getObject());
				} else if (le.getEventType() == LifecycleApplicationEvent.MODIFIED) {
					handleUpdatedObject(le.getObject());
				} else if (le.getEventType() == LifecycleApplicationEvent.DELETED) {
					handleDeletedObject(le.getObject());
				}
			}
		}
	}
300188
public function onModules( ModulesEvent $event )
    {
        $saved      = 0;
        $model      = $event->getTarget();
        $mapper     = $model->getMapper();
        $modules    = $event->getParams();

        foreach ( $modules as $name => $enabled )
        {
            if ( empty( $name ) )
            {
                continue;
            }

            $name   = (string) $name;
            $module = $model->findByName( $name );

            if ( empty( $module ) )
            {
                $module = $model->create( array(
                    'module'    => $name,
                    'enabled'   => $enabled,
                ) );
            }
            else
            {
                $module->enabled = $enabled;
            }

            $saved += $mapper->save( $module );
        }

        return $saved;
    }
942743
public function init($moduleManager)
    {
        $event = $moduleManager->getEvent();
        $container = $event->getParam('ServiceManager');
        $serviceListener = $container->get('ServiceListener');

        $serviceListener->addServiceManager(
            'FilterManager',
            'filters',
            'Zend\ModuleManager\Feature\FilterProviderInterface',
            'getFilterConfig'
        );
    }
202233
public function onBootstrap(EventInterface $e)
    {
        /** @var ServiceManager $serviceManager */
        $serviceManager = $e->getApplication()->getServiceManager();

        /** @var Environment $environment */
        $environment = $serviceManager->get(Environment::class);

        if ($environment->is(\Admin42\Module::ENVIRONMENT_ADMIN)) {
            $serviceManager
                ->get(PageEventListener::class)
                ->attach($e->getApplication()->getServiceManager()->get('Frontend42\Page\EventManager'));
        }

        if (!$environment->is(\Admin42\Module::ENVIRONMENT_ADMIN)) {
            $e->getApplication()
                ->getEventManager()
                ->attach(MvcEvent::EVENT_DISPATCH_ERROR, function ($e) use ($serviceManager){
                    /** @var Localization $localization */
                    $localization = $serviceManager->get(Localization::class);
                    $localization->acceptLocale($localization->getDefaultLocale());
                    $serviceManager->get(TranslatorInterface::class)->setLocale($localization->getActiveLocale());
                }, 100);
        }
    }
640390
public function loadBootstrap( SuiteEvent $e ) {
		$settings = $e->getSettings();
		if ( ! isset( $settings['bootstrap'] ) || ! filter_var( $settings['bootstrap'], FILTER_VALIDATE_BOOLEAN ) ) {
			return;
		}

		$bootstrap = $settings['path'] . $settings['bootstrap'];
		if ( ! is_file( $bootstrap ) ) {
			throw new ConfigurationException( "Bootstrap file {$bootstrap} can't be loaded" );
		}

		require_once $bootstrap;
	}
1268318
public function onDispatch(MvcEvent $e)
    {
        if (!$e->getRequest() instanceof HttpRequest) {
            return;
        }

        $sem = $e->getApplication()->getEventManager()->getSharedManager();
        $sem->attach('UploadableManager', 'createFile', [$this, 'onCreateFile']);
    }
1311704
public function handleContextAnnotation($e)
    {
        $annotation = $e->getParam('annotation');
        if (!$annotation instanceof Annotation\Context) {
            return;
        }
    
        $spec = $e->getParam($this->getEventParamName());
        $spec['contexts'] = $annotation->getContext();
    }
1217614
function(module, name, config, module_storage) {

		this._module = module;
		this._name = name;
		this._config = config;
		this._properties_by_guid = module_storage;
		if ('is_nullable' in config) this._is_nullable = config.is_nullable;

	}
962174
@Override
    public void onBeforeExecutionEvent(BeforeExecutionEvent event) {
        LepManager manager = event.getSource();
        ScopedContext threadContext = manager.getContext(ContextScopes.THREAD);
        if (threadContext == null) {
            throw new IllegalStateException("LEP manager thread context doesn't initialized");
        }

        TenantContext tenantContext = getRequiredValue(threadContext, THREAD_CONTEXT_KEY_TENANT_CONTEXT,
                                                       TenantContext.class);
        XmAuthenticationContext authContext = getRequiredValue(threadContext, THREAD_CONTEXT_KEY_AUTH_CONTEXT,
                                                               XmAuthenticationContext.class);

        ScopedContext executionContext = manager.getContext(ContextScopes.EXECUTION);
        // add contexts
        executionContext.setValue(BINDING_KEY_TENANT_CONTEXT, tenantContext);
        executionContext.setValue(BINDING_KEY_AUTH_CONTEXT, authContext);

        bindExecutionContext(executionContext);
    }
1126398
public function onTemplateCreated(TemplateEvent $event)
    {
        $template = $event->getTemplate();
        $zones = $template->getZones();
        foreach ($template->getTemplateType()->getZoneTypes() as $zoneType) {
            if ($zones->search(array('zoneType' => $zoneType))->isEmpty()) {
                if (null === $this->zoneDomain) {
                    throw new \DomainException('No zoneDomain was set, you are unable to update your configuration.');
                }

                $zones->add($this->zoneDomain->create($zoneType));
            }
        }
        $template->setZones($zones);
    }
812544
public function suiteInit(SuiteEvent $e)
    {
        // Check if PhantomJS should only be started for specific suites.
        if (isset($this->config['suites'])) {
            if (is_string($this->config['suites'])) {
                $suites = [$this->config['suites']];
            } else {
                $suites = $this->config['suites'];
            }

            // If the current suites aren't in the desired array, return without
            // starting PhantomJS.
            if (!in_array($e->getSuite()->getBaseName(), $suites, true)
                && !in_array($e->getSuite()->getName(), $suites, true)) {
                return;
            }
        }

        // Start the PhantomJS server.
        $this->startServer();
    }