You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

38 satır
1.1KB

  1. <?php
  2. namespace Lc\CaracoleBundle\Builder\Merchant;
  3. use Lc\CaracoleBundle\Model\Merchant\MerchantInterface;
  4. use Lc\CaracoleBundle\Resolver\MerchantResolver;
  5. use Lc\SovBundle\Component\CookieComponent;
  6. use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
  7. use Symfony\Component\HttpFoundation\Cookie;
  8. class MerchantBuilder
  9. {
  10. protected ParameterBagInterface $parameterBag;
  11. protected CookieComponent $cookieComponent;
  12. public function __construct(
  13. ParameterBagInterface $parameterBag,
  14. CookieComponent $cookieComponent
  15. ) {
  16. $this->parameterBag = $parameterBag;
  17. $this->cookieComponent = $cookieComponent;
  18. }
  19. public function setCookieMerchantCurrent($response, MerchantInterface $merchant) :void
  20. {
  21. $response->headers->setCookie(
  22. Cookie::create(
  23. $this->parameterBag->get('app.cookie_name_merchant_current'),
  24. $merchant->getId(),
  25. 0,
  26. '/',
  27. $this->cookieComponent->getCookieDomain()
  28. )
  29. );
  30. }
  31. }