Beispiel #1
0
 /**
  * Saves the module's settings to the database
  *
  * @param array $data
  * @param string $module
  *
  * @return bool
  */
 public function saveSettings($data, $module)
 {
     $bool = $bool2 = false;
     $moduleId = $this->systemModuleRepository->getModuleId($module);
     if (!empty($moduleId)) {
         $this->eventDispatcher->dispatch('core.settings.save_before', new SettingsSaveEvent($module, $data));
         foreach ($data as $key => $value) {
             $updateValues = ['value' => $value];
             $where = ['module_id' => $moduleId, 'name' => $key];
             $bool = $this->systemSettingsRepository->update($updateValues, $where);
         }
         $bool2 = $this->saveCache();
     }
     return $bool !== false && $bool2 !== false;
 }
Beispiel #2
0
 /**
  * Returns the module-ID
  *
  * @param string $moduleName
  *
  * @return int
  */
 public function getModuleId($moduleName)
 {
     return $this->systemModuleRepository->getModuleId($moduleName) ?: 0;
 }