<?php declare(strict_types=1);
namespace Swag\ExamplePlugin\Core\Checkout\Customer\Event;
use Shopware\Core\Checkout\Customer\CustomerDefinition;
use Shopware\Core\Checkout\Customer\CustomerEntity;
use Shopware\Core\Framework\Context;
use Shopware\Core\Framework\Event\CustomerAware;
use Shopware\Core\Framework\Event\BusinessEventInterface;
use Shopware\Core\Framework\Event\EventData\EntityType;
use Shopware\Core\Framework\Event\EventData\EventDataCollection;
use Symfony\Contracts\EventDispatcher\Event;
class ExampleEvent extends Event implements CustomerAware, BusinessEventInterface
public const EVENT_NAME = 'example.event';
private CustomerEntity $customer;
private Context $context;
public function __construct(Context $context, CustomerEntity $customer)
$this->customer = $customer;
$this->context = $context;
public function getName(): string
public function getCustomer(): CustomerEntity
public function getCustomerId(): string
return $this->customer->getId();
public static function getAvailableData(): EventDataCollection
return (new EventDataCollection())
->add('customer', new EntityType(CustomerDefinition::class));
public function getContext(): Context