Skip to content

Commit

Permalink
NTR: fix pipeline
Browse files Browse the repository at this point in the history
  • Loading branch information
Vitalij Mik committed Jan 15, 2025
1 parent 87bdb68 commit 4b56dde
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
2 changes: 1 addition & 1 deletion shopware/Component/Settings/Resources/config/services.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<services>

<service id="Mollie\Shopware\Component\Settings\SettingsService">
<argument type="service" id="Shopware\Core\System\SystemConfig\SystemConfigService"/>
<argument type="service" id="service_container"/>
</service>


Expand Down
16 changes: 11 additions & 5 deletions shopware/Component/Settings/SettingsService.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
namespace Mollie\Shopware\Component\Settings;

use Mollie\Shopware\Component\Settings\Struct\LoggerSettings;
use Psr\Container\ContainerInterface;
use Shopware\Core\Framework\Plugin\Exception\DecorationPatternException;
use Shopware\Core\System\SystemConfig\SystemConfigService;

Expand All @@ -13,15 +14,15 @@ final class SettingsService extends AbstractSettingsService
private const CACHE_KEY_LOGGER = 'logger';
private const CACHE_KEY_SHOPWARE = 'shopware';

private SystemConfigService $systemConfigService;
private ?SystemConfigService $systemConfigService = null;

private array $settingsCache = [];
private ContainerInterface $container;



public function __construct(SystemConfigService $systemConfigService)
public function __construct(ContainerInterface $container)
{
$this->systemConfigService = $systemConfigService;
$this->container = $container;
}

public function getDecorated(): AbstractSettingsService
Expand Down Expand Up @@ -52,7 +53,12 @@ private function getShopwareSettings(?string $salesChannelId = null): array
if (isset($this->settingsCache[$cacheKey])) {
return $this->settingsCache[$cacheKey];
}

/**
* Attention, we have to use service locator here, because in Shopware 6.4 there is an issue with system config service.
*/
if($this->systemConfigService === null){
$this->systemConfigService = $this->container->get(SystemConfigService::class);
}
$shopwareSettingsArray = $this->systemConfigService->get(self::SYSTEM_CONFIG_DOMAIN, $salesChannelId);
$this->settingsCache[$cacheKey] = $shopwareSettingsArray;
return $shopwareSettingsArray;
Expand Down

0 comments on commit 4b56dde

Please sign in to comment.