<?php declare(strict_types=1);
namespace Pixup\Wishlist\Subscriber;
use Shopware\Core\Checkout\Customer\Event\CustomerLogoutEvent;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Symfony\Component\HttpFoundation\Session\Session;
class WishlistCustomerLogoutSubscriber implements EventSubscriberInterface
{
/** @var Session */
private $session;
public function __construct(Session $session)
{
$this->session = $session;
}
public static function getSubscribedEvents()
{
return [
CustomerLogoutEvent::class => 'removeWishlistSessionAttributes'
];
}
public function removeWishlistSessionAttributes(CustomerLogoutEvent $event)
{
$this->session->remove('wishlists');
}
}