retrieve module settings from settings service instead from outdated configuration

This commit is contained in:
Daniel Seifert 2024-03-15 15:55:56 +01:00 committed by Daniel Seifert
parent 42fe5c8ca2
commit 4548be2986
2 changed files with 18 additions and 10 deletions

View File

@ -24,8 +24,10 @@ use D3\DataWizard\Application\Model\Exceptions\TaskException;
use D3\ModCfg\Application\Model\d3database; use D3\ModCfg\Application\Model\d3database;
use Doctrine\DBAL\Exception as DBALException; use Doctrine\DBAL\Exception as DBALException;
use OxidEsales\Eshop\Application\Controller\Admin\AdminDetailsController; use OxidEsales\Eshop\Application\Controller\Admin\AdminDetailsController;
use OxidEsales\Eshop\Core\Config;
use OxidEsales\Eshop\Core\Registry; use OxidEsales\Eshop\Core\Registry;
use OxidEsales\EshopCommunity\Internal\Container\ContainerFactory;
use OxidEsales\EshopCommunity\Internal\Framework\Module\Facade\ModuleSettingService;
use OxidEsales\EshopCommunity\Internal\Framework\Module\Facade\ModuleSettingServiceInterface;
use Psr\Container\ContainerExceptionInterface; use Psr\Container\ContainerExceptionInterface;
use Psr\Container\NotFoundExceptionInterface; use Psr\Container\NotFoundExceptionInterface;
@ -85,7 +87,7 @@ class d3ActionWizard extends AdminDetailsController
[ $queryString, $parameters ] = $action->getQuery(); [ $queryString, $parameters ] = $action->getQuery();
if ($this->d3GetConfig()->getConfigParam('d3datawizard_debug')) { if ($this->getSettingsService()->getBoolean('d3datawizard_debug', Constants::OXID_MODULE_ID)) {
/** @var DebugException $debug */ /** @var DebugException $debug */
$debug = oxNew( $debug = oxNew(
DebugException::class, DebugException::class,
@ -98,11 +100,13 @@ class d3ActionWizard extends AdminDetailsController
} }
/** /**
* @return Config * @return ModuleSettingService
* @throws ContainerExceptionInterface
* @throws NotFoundExceptionInterface
*/ */
public function d3GetConfig(): Config public function getSettingsService(): ModuleSettingServiceInterface
{ {
return Registry::getConfig(); return ContainerFactory::getInstance()->getContainer()->get(ModuleSettingServiceInterface::class);
} }
public function getUserMessages(): ?string public function getUserMessages(): ?string

View File

@ -26,11 +26,13 @@ use D3\ModCfg\Application\Model\Exception\d3ShopCompatibilityAdapterException;
use Doctrine\DBAL\Driver\Exception; use Doctrine\DBAL\Driver\Exception;
use Doctrine\DBAL\Exception as DBALException; use Doctrine\DBAL\Exception as DBALException;
use OxidEsales\Eshop\Application\Controller\Admin\AdminDetailsController; use OxidEsales\Eshop\Application\Controller\Admin\AdminDetailsController;
use OxidEsales\Eshop\Core\Config;
use OxidEsales\Eshop\Core\Exception\DatabaseConnectionException; use OxidEsales\Eshop\Core\Exception\DatabaseConnectionException;
use OxidEsales\Eshop\Core\Exception\DatabaseErrorException; use OxidEsales\Eshop\Core\Exception\DatabaseErrorException;
use OxidEsales\Eshop\Core\Exception\StandardException; use OxidEsales\Eshop\Core\Exception\StandardException;
use OxidEsales\Eshop\Core\Registry; use OxidEsales\Eshop\Core\Registry;
use OxidEsales\EshopCommunity\Internal\Container\ContainerFactory;
use OxidEsales\EshopCommunity\Internal\Framework\Module\Facade\ModuleSettingService;
use OxidEsales\EshopCommunity\Internal\Framework\Module\Facade\ModuleSettingServiceInterface;
use Psr\Container\ContainerExceptionInterface; use Psr\Container\ContainerExceptionInterface;
use Psr\Container\NotFoundExceptionInterface; use Psr\Container\NotFoundExceptionInterface;
@ -100,7 +102,7 @@ class d3ExportWizard extends AdminDetailsController
[ $queryString, $parameters ] = $export->getQuery(); [ $queryString, $parameters ] = $export->getQuery();
if ($this->d3GetConfig()->getConfigParam('d3datawizard_debug')) { if ($this->getSettingsService()->getBoolean('d3datawizard_debug', Constants::OXID_MODULE_ID)) {
throw oxNew( throw oxNew(
DebugException::class, DebugException::class,
d3database::getInstance()->getPreparedStatementQuery($queryString, $parameters) d3database::getInstance()->getPreparedStatementQuery($queryString, $parameters)
@ -111,11 +113,13 @@ class d3ExportWizard extends AdminDetailsController
} }
/** /**
* @return Config * @return ModuleSettingService
* @throws ContainerExceptionInterface
* @throws NotFoundExceptionInterface
*/ */
public function d3GetConfig(): Config public function getSettingsService(): ModuleSettingServiceInterface
{ {
return Registry::getConfig(); return ContainerFactory::getInstance()->getContainer()->get(ModuleSettingServiceInterface::class);
} }
public function getUserMessages(): ?string public function getUserMessages(): ?string