Add configs array handling methods to SystemConfigProviderInterface

- Add method to get config array
- Add method to update config array
- Add method to get default configs
This commit is contained in:
Clemente Raposo 2022-03-10 16:07:25 +00:00
parent aae9271c1b
commit 0e7b2c7539
2 changed files with 52 additions and 0 deletions

View file

@ -166,6 +166,38 @@ class SystemConfigHandler extends LegacyHandler implements SystemConfigProviderI
return self::HANDLER_KEY;
}
/**
* @inheritDoc
*/
public function getConfigs(): ?array
{
$this->init();
$config = $this->getLegacyConfig($this->legacyDir);
$this->close();
return $config;
}
/**
* @inheritDoc
*/
public function getConfigDefaults(): ?array
{
$this->init();
try {
$defaults = get_sugar_config_defaults();
} catch (Exception $exception) {
return null;
}
$this->close();
return $defaults;
}
/**
* Get system config
* @param array $config

View file

@ -28,6 +28,7 @@
namespace App\SystemConfig\Service;
use App\Engine\Model\Feedback;
use App\SystemConfig\Entity\SystemConfig;
interface SystemConfigProviderInterface
@ -45,4 +46,23 @@ interface SystemConfigProviderInterface
* @return SystemConfig|null
*/
public function getSystemConfig(string $configKey): ?SystemConfig;
/**
* Get legacy config array
* @return array|null
*/
public function getConfigs(): ?array;
/**
* Get legacy config defaults
* @return array|null
*/
public function getConfigDefaults(): ?array;
/**
* Get system config
* @param array $config
* @return Feedback
*/
public function updateSystemConfig(array $config): Feedback;
}