|
|
@@ -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; |
|
|
|
} |