|
- <?php
-
- namespace Lc\CaracoleBundle\Builder\Merchant;
-
- use Lc\CaracoleBundle\Model\Merchant\MerchantInterface;
- use Lc\CaracoleBundle\Resolver\MerchantResolver;
- use Lc\SovBundle\Component\CookieComponent;
- use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
- use Symfony\Component\HttpFoundation\Cookie;
-
- class MerchantBuilder
- {
- protected ParameterBagInterface $parameterBag;
- protected CookieComponent $cookieComponent;
-
- public function __construct(
- ParameterBagInterface $parameterBag,
- CookieComponent $cookieComponent
- ) {
- $this->parameterBag = $parameterBag;
- $this->cookieComponent = $cookieComponent;
- }
-
- public function setCookieMerchantCurrent($response, MerchantInterface $merchant)
- {
- $response->headers->setCookie(
- Cookie::create(
- $this->parameterBag->get('app.cookie_name_merchant_current'),
- $merchant->getId(),
- 0,
- '/',
- $this->cookieComponent->getCookieDomain()
- )
- );
- }
-
- }
|