소스 검색

Merge branch 'develop' of https://forge.laclic.fr/Laclic/CaracoleBundle into develop

packProduct
Fabien Normand 3 년 전
부모
커밋
c400e602e8
1개의 변경된 파일23개의 추가작업 그리고 12개의 파일을 삭제
  1. +23
    -12
      Resolver/MerchantResolver.php

+ 23
- 12
Resolver/MerchantResolver.php 파일 보기

@@ -142,24 +142,35 @@ class MerchantResolver
$user = $this->security->getUser();
}

$merchants = $this->merchantStore->getOnline();

if ($user) {
return $user->getFavoriteMerchant();
} else {
$merchantCurrentId = $this->requestStack->getCurrentRequest()->cookies->getInt(
$this->parameterBag->get('app.cookie_name_merchant_current')
);
if ($merchantCurrentId) {
foreach ($merchants as $merchant) {
if ($merchant->getId() == $merchantCurrentId) {
return $merchant;
}
}
}
else {
$merchantCurrent = $this->getMerchantUserViaCookie();
if($merchantCurrent) {
return $merchantCurrent;
}
}

return false;
}

public function getMerchantUserViaCookie()
{
$merchants = $this->merchantStore->getOnline();
$merchantCurrentId = $this->requestStack->getCurrentRequest()->cookies->getInt(
$this->parameterBag->get('app.cookie_name_merchant_current')
);

if ($merchantCurrentId) {
foreach ($merchants as $merchant) {
if ($merchant->getId() == $merchantCurrentId) {
return $merchant;
}
}
}

return null;
}

}

Loading…
취소
저장