Event dispatched after a payment method is deleted.
Typical use case is to perform additional operations after payment method deletion (e.g. logging, cache purge, reindexing, etc.)
The following example log the deletion of the payment method:
final class PaymentMethodEventSubscriber implements EventSubscriberInterface
{
private function __construct(private LoggerInterface $logger)
{
}
public static function getSubscribedEvents(): array
{
return [
DeletePaymentMethodEvent::class => 'onDeletePaymentMethod',
];
}
public function onDeletePaymentMethod(DeletePaymentMethodEvent $event): void
{
$paymentMethod = $event->getPaymentMethod();
$this->logger->info(
'Payment method {name} has been deleted',
[
'name' => $paymentMethod->getName()
]
);
}
}
Methods¶
__construct() ¶
DeletePaymentMethodEvent.php
:
52
|
|
Parameters
Name | Type | Default value | Description |
---|---|---|---|
$paymentMethod | PaymentMethodInterface | - | - |
getPaymentMethod() ¶
DeletePaymentMethodEvent.php
:
60
Returns the payment method that has been deleted.
|
|
Return values
isPropagationStopped() ¶
Event.php
:
38
|
|
Return values
bool
stopPropagation() ¶
Event.php
:
50
Stops the propagation of the event to further event listeners.
|
|
If multiple event listeners are connected to the same event, no further event listener will be triggered once any trigger calls stopPropagation().