Copied!

DeletePaymentEvent

DeletePaymentEvent.php : 51
Extends AfterEvent

Event dispatched after a payment is deleted.

Typical use case is to perform additional operations after payment deletion (e.g. logging, cache purge, reindexing, etc.)

The following example logs the deletion of the payment:

final class PaymentEventSubscriber implements EventSubscriberInterface
{
   private function __construct(private LoggerInterface $logger)
   {
   }

   public static function getSubscribedEvents(): array
   {
       return [
           DeletePaymentEvent::class => 'onDeletePayment',
       ];
    }

   public function onDeletePayment(DeletePaymentEvent $event): void
   {
       $payment = $event->getPayment();

       $this->logger->info(
           'Payment {identifier} has been deleted',
           [
               'name' => $payment->getIdentifier()
           ]
       );
   }
}
Tags
See
PaymentServiceInterface::deletePayment()

Methods

public__construct()

DeletePaymentEvent.php : 55
public __construct(PaymentInterface $payment)

Parameters

Name Type Default value Description
$payment PaymentInterface - -

publicgetPayment()

DeletePaymentEvent.php : 63

Returns the payment that has been deleted.

public getPayment() : PaymentInterface

Return values

PaymentInterface

publicisPropagationStopped()

Event.php : 38
public isPropagationStopped() : bool

Return values

bool

publicstopPropagation()

Event.php : 50

Stops the propagation of the event to further event listeners.

public stopPropagation() : void

If multiple event listeners are connected to the same event, no further event listener will be triggered once any trigger calls stopPropagation().