Bläddra i källkod

MerchantResolver

packProduct
Guillaume 2 år sedan
förälder
incheckning
b568200366
1 ändrade filer med 6 tillägg och 2 borttagningar
  1. +6
    -2
      Resolver/MerchantResolver.php

+ 6
- 2
Resolver/MerchantResolver.php Visa fil

use Lc\CaracoleBundle\Repository\User\UserMerchantRepository; use Lc\CaracoleBundle\Repository\User\UserMerchantRepository;
use Lc\SovBundle\Model\User\UserInterface; use Lc\SovBundle\Model\User\UserInterface;
use Lc\SovBundle\Resolver\UrlResolver; use Lc\SovBundle\Resolver\UrlResolver;
use Lc\SovBundle\Solver\Setting\SettingSolver;
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface; use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
use Symfony\Component\HttpFoundation\RequestStack; use Symfony\Component\HttpFoundation\RequestStack;
use Symfony\Component\Routing\Generator\UrlGeneratorInterface; use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
protected UrlGeneratorInterface $router; protected UrlGeneratorInterface $router;
protected MerchantStore $merchantStore; protected MerchantStore $merchantStore;
protected ParameterBagInterface $parameterBag; protected ParameterBagInterface $parameterBag;
protected SettingSolver $settingSolver;


public function __construct( public function __construct(
EntityManagerInterface $entityManager, EntityManagerInterface $entityManager,
UserMerchantRepository $userMerchantRepository, UserMerchantRepository $userMerchantRepository,
UrlGeneratorInterface $router, UrlGeneratorInterface $router,
MerchantStore $merchantStore, MerchantStore $merchantStore,
ParameterBagInterface $parameterBag
ParameterBagInterface $parameterBag,
SettingSolver $settingSolver
) { ) {
$this->requestStack = $requestStack; $this->requestStack = $requestStack;
$this->em = $entityManager; $this->em = $entityManager;
$this->merchantStore = $merchantStore; $this->merchantStore = $merchantStore;
$this->router = $router; $this->router = $router;
$this->parameterBag = $parameterBag; $this->parameterBag = $parameterBag;
$this->settingSolver = $settingSolver;
} }


public function getCurrent(): MerchantInterface public function getCurrent(): MerchantInterface
} // distant } // distant
else { else {
foreach ($merchants as $merchant) { 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) { if ($url && strlen($url) && strpos($url, $_SERVER['HTTP_HOST']) !== false) {
$this->currentMerchant = $merchant; $this->currentMerchant = $merchant;
} }

Laddar…
Avbryt
Spara