Add controllers map for a given module Id to config

@param array  $moduleControllers Map of controller ids and class names
@param string $moduleId          The Id of the module
@param Module $module            Module core class
177944
protected function setModuleControllers($moduleControllers, $moduleId, $module)
    {

        if ($module->isActive()) {
            $classProviderStorage = $this->getClassProviderStorage();
            $dbMap = $classProviderStorage->get();
            $controllersForThatModuleInDb = isset($dbMap[$moduleId]) ? $dbMap[$moduleId] : [];
            $duplicatedKeys = array_intersect_key(
                array_change_key_case($moduleControllers, CASE_LOWER), $controllersForThatModuleInDb
            );
            if (array_diff_assoc($moduleControllers, $duplicatedKeys)) {
                $this->output->writeLn("$moduleId fix module ModuleControllers");
                $this->deleteModuleControllers($moduleId);
                $this->resetModuleCache($module);
                $this->validateModuleMetadataControllersOnActivation($moduleControllers);

                $classProviderStorage = $this->getClassProviderStorage();

                $classProviderStorage->add($moduleId, $moduleControllers);
                $this->needCacheClear = true;
            }
        } else {
            $moduleCache = oxNew( \OxidEsales\Eshop\Core\Module\ModuleCache::class, $module);
            $moduleInstaller = oxNew(\OxidEsales\Eshop\Core\Module\ModuleInstaller::class, $moduleCache);
            $moduleInstaller->deactivate($module);}
    }
908726
public function addController(ContentControllerInterface $controller)
    {
        $contentClass = $controller->getContentClass();

        if (isset($this->controllers[$contentClass])) {
            throw new ControllerException(sprintf('Content controller for class "%s" already added.', $contentClass));
        }

        $this->controllers[$contentClass] = $controller;
    }
944865
protected function setModule($module_id)
    {
        $this->data_module = $this->module->get($module_id);

        if (empty($this->data_module)) {
            $this->outputHttpStatus(403);
        }
    }
411612
private function createModuleBaseFiles($module, $mod_path, $force = false, $controllerType = '')
    {
        $module_path = $mod_path . $module;
        $this->generateControllerTemplate($module, $module_path, $force, $controllerType);
        $this->generateServiceTemplate($module, $module_path, $force);
        $this->genereateAutoloaderTemplate($module, $module_path, $force);
        $this->generateSchemaTemplate($module, $module_path, $force);
        $this->generatePropertiesTemplate($module, $module_path, $force);
        $this->generateConfigTemplate($module_path, $force);
        $this->generateIndexTemplate($module, $module_path, $force);
        $this->generatePublicTemplates($module_path, $force);
    }
612612
public function setModules( $modules )
    {
        $saved = 0;
        $event = new ModulesEvent(
            ModulesEvent::EVENT_MODULES,
            $this,
            $modules
        );

        $event->setServiceLocator( $this->getServiceLocator() );

        /* @var $responses \Zend\EventManager\ResponseCollection */
        $responses = $this->getEventManager()
                          ->trigger( $event );

        foreach ( $responses as $response )
        {
            $saved += (int) $response;
        }

        return $saved;
    }
954888
public function getModuleConfiguration(string $moduleId) : ModuleConfiguration
    {
        if (array_key_exists($moduleId, $this->moduleConfigurations)) {
            return $this->moduleConfigurations[$moduleId];
        }
        throw new DomainException('There is no module configuration with id ' . $moduleId);
    }
690855
protected function setModuleAssets($controller)
    {
        if (!$controller->isInternalRoute()) {

            $settings = $this->module->getSettings('dev');

            if (!empty($settings['status'])) {
                $controller->setJsSettings('dev', array('key' => $settings['key']));
                $controller->setJs(__DIR__ . '/js/common.js', array('position' => 'bottom'));
                $controller->setCss(__DIR__ . '/css/common.css');
            }
        }
    }
489615
public function get(string $module, string $controller): Link
    {
        return $this->addMap(RequestMethod::GET, $module, $controller);
    }
36327
public function activate(string $moduleId, int $shopId)
    {
        if ($this->stateService->isActive($moduleId, $shopId) === true) {
            throw new ModuleSetupException('Module with id "'. $moduleId . '" is already active.');
        }

        $moduleConfiguration = $this->moduleConfigurationDao->get($moduleId, $shopId);

        $this->moduleSettingsHandlingService->handleOnActivation($moduleConfiguration, $shopId);

        $this->moduleServicesActivationService->activateModuleServices($moduleId, $shopId);

        $this->stateService->setActive($moduleId, $shopId);

        $moduleConfiguration->setAutoActive(true);
        $this->moduleConfigurationDao->save($moduleConfiguration, $shopId);

        $this->classExtensionChainService->updateChain($shopId);

        $this->eventDispatcher->dispatch(
            FinalizingModuleActivationEvent::NAME,
            new FinalizingModuleActivationEvent($shopId, $moduleId)
        );
    }
781978
public function setModules($modules)
	{
		foreach ($modules as $name => $module) {
		    $this->setModule($name, $module);
		}
		
		return $this;
	}
807112
protected function makeController($name, $module, $is_module = false) {
        return ModuleGenerator::renderTemplate('Controller', [
            'module' => $module,
            'name' => $name,
            'is_module' => $is_module
        ]);
    }
757214
public function handleOnModuleActivation(ModuleSetting $moduleSetting, string $moduleId, int $shopId)
    {
        if (!$this->canHandle($moduleSetting)) {
            throw new WrongModuleSettingException($moduleSetting, self::class);
        }

        $templateBlocksData = $moduleSetting->getValue();

        foreach ($templateBlocksData as $templateBlockData) {
            $templateBlockExtension = $this->mapDataToObject($templateBlockData);
            $templateBlockExtension->setShopId($shopId);
            $templateBlockExtension->setModuleId($moduleId);

            $this->templateBlockExtensionDao->add($templateBlockExtension);
        }
    }
841137
protected function addModuleSettings($moduleSettings, $moduleId)
    {
        $this->removeNotUsedSettings($moduleSettings, $moduleId);
        $config = \OxidEsales\Eshop\Core\Registry::getConfig();
        $shopId = $config->getShopId();
        $moduleConfigs = $this->getModuleConfigs($moduleId);
        $db = \OxidEsales\Eshop\Core\DatabaseProvider::getDb();

        if (is_array($moduleSettings)) {
            foreach ($moduleSettings as $setting) {
                $oxid = \OxidEsales\Eshop\Core\Registry::getUtilsObject()->generateUId();

                $module = $this->getModuleConfigId($moduleId);
                $name = $setting["name"];
                $type = $setting["type"];

                if ($this->isTheme($moduleId)) {
                    $value = array_key_exists($name, $moduleConfigs) ? $moduleConfigs[$name] : $setting["value"];
                } else {
                    $value = is_null($config->getConfigParam($name)) ? $setting["value"] : $config->getConfigParam($name);
                }

                $group = $setting["group"];

                $constraints = "";
                if (isset($setting["constraints"]) && $setting["constraints"]) {
                    $constraints = $setting["constraints"];
                } elseif (isset($setting["constrains"]) && $setting["constrains"]) {
                    $constraints = $setting["constrains"];
                }

                $position = 1;
                if (isset($setting["position"])) {
                    $position = $setting["position"];
                }

                $config->saveShopConfVar($type, $name, $value, $shopId, $module);

                $deleteSql = "DELETE FROM `oxconfigdisplay` WHERE OXCFGMODULE=" . $db->quote($module) . " AND OXCFGVARNAME=" . $db->quote($name);
                $insertSql = "INSERT INTO `oxconfigdisplay` (`OXID`, `OXCFGMODULE`, `OXCFGVARNAME`, `OXGROUPING`, `OXVARCONSTRAINT`, `OXPOS`) " .
                "VALUES ('{$oxid}', " . $db->quote($module) . ", " . $db->quote($name) . ", " . $db->quote($group) . ", " . $db->quote($constraints) . ", " . $db->quote($position) . ")";

                $db->execute($deleteSql);
                $db->execute($insertSql);
            }
        }
    }
439215
private function restoreModuleInformation($module, $moduleId)
    {
        $this->_addExtensions($module);
        $metaDataVersion = $module->getMetaDataVersion();
        $metaDataVersion = $metaDataVersion == '' ? $metaDataVersion = "1.0" : $metaDataVersion; 
        if (version_compare($metaDataVersion, '2.0', '<')) {
            $this->_addModuleFiles($module->getInfo("files"), $moduleId);
        }
        $this->_addTemplateBlocks($module->getInfo("blocks"), $moduleId);
        $this->_addTemplateFiles($module->getInfo("templates"), $moduleId);
        $this->_addModuleSettings($module->getInfo("settings"), $moduleId);
        $this->_addModuleVersion($module->getInfo("version"), $moduleId);
        $this->_addModuleExtensions($module->getExtensions(), $moduleId);
        $this->_addModuleEvents($module->getInfo("events"), $moduleId);

        if (version_compare($metaDataVersion, '2.0', '>=')) {
            try {
                $this->setModuleControllers($module->getControllers(), $moduleId, $module);
            } catch (ModuleValidationException $exception) {
                print "[ERROR]: duplicate controllers:" . $exception->getMessage() ."\n";
            }
        }
    }
550178
public function validate(ModuleSetting $moduleSetting, string $moduleId, int $shopId)
    {
        if (!$this->canValidate($moduleSetting)) {
            throw new WrongModuleSettingException($moduleSetting, self::class);
        }

        $shopControllerClassMap = $this->shopAdapter->getShopControllerClassMap();

        $controllerClassMap = array_merge(
            $shopControllerClassMap,
            $this->getModulesControllerClassMap($shopId)
        );

        $this->validateForControllerKeyDuplication($moduleSetting, $controllerClassMap);
        $this->validateForControllerNamespaceDuplication($moduleSetting, $controllerClassMap);
    }
170090
public function get($module_id)
    {
        $modules = $this->getList();
        return empty($modules[$module_id]) ? array() : $modules[$module_id];
    }
298122
function setModuleConfig(moduleConfig) {
                    if (!angular.isObject(moduleConfig)) {
                        throw new Error('You need to give the module config object to set');
                    }
                    modules[moduleConfig.name] = moduleConfig;
                    return moduleConfig;
                }