Files
kupshop/bundles/KupShop/UserBundle/EventSubscriber/LogoutSubscriber.php
2025-08-02 16:30:27 +02:00

33 lines
665 B
PHP

<?php
declare(strict_types=1);
namespace KupShop\UserBundle\EventSubscriber;
use KupShop\OrderingBundle\Cart;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Symfony\Component\Security\Http\Event\LogoutEvent;
class LogoutSubscriber implements EventSubscriberInterface
{
public function __construct(
private Cart $cart,
) {
}
public static function getSubscribedEvents(): array
{
return [
LogoutEvent::class => [
['onLogout', 200],
],
];
}
public function onLogout(): void
{
// Notify cart
$this->cart->userLoggedOut();
}
}