瀏覽代碼

MerchantResolver

packProduct
Guillaume 3 年之前
父節點
當前提交
b568200366
共有 1 個檔案被更改,包括 6 行新增2 行删除
  1. +6
    -2
      Resolver/MerchantResolver.php

+ 6
- 2
Resolver/MerchantResolver.php 查看文件

@@ -17,6 +17,7 @@ use Lc\CaracoleBundle\Repository\Merchant\MerchantStore;
use Lc\CaracoleBundle\Repository\User\UserMerchantRepository;
use Lc\SovBundle\Model\User\UserInterface;
use Lc\SovBundle\Resolver\UrlResolver;
use Lc\SovBundle\Solver\Setting\SettingSolver;
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
use Symfony\Component\HttpFoundation\RequestStack;
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
@@ -34,6 +35,7 @@ class MerchantResolver
protected UrlGeneratorInterface $router;
protected MerchantStore $merchantStore;
protected ParameterBagInterface $parameterBag;
protected SettingSolver $settingSolver;

public function __construct(
EntityManagerInterface $entityManager,
@@ -44,7 +46,8 @@ class MerchantResolver
UserMerchantRepository $userMerchantRepository,
UrlGeneratorInterface $router,
MerchantStore $merchantStore,
ParameterBagInterface $parameterBag
ParameterBagInterface $parameterBag,
SettingSolver $settingSolver
) {
$this->requestStack = $requestStack;
$this->em = $entityManager;
@@ -55,6 +58,7 @@ class MerchantResolver
$this->merchantStore = $merchantStore;
$this->router = $router;
$this->parameterBag = $parameterBag;
$this->settingSolver = $settingSolver;
}

public function getCurrent(): MerchantInterface
@@ -78,7 +82,7 @@ class MerchantResolver
} // distant
else {
foreach ($merchants as $merchant) {
$url = $merchant->getSettingValue(MerchantSettingDefinition::SETTING_URL);
$url = $this->settingSolver->getSettingValue($merchant, MerchantSettingDefinition::SETTING_URL);
if ($url && strlen($url) && strpos($url, $_SERVER['HTTP_HOST']) !== false) {
$this->currentMerchant = $merchant;
}

Loading…
取消
儲存