Payment/EventListener/AbstractPaymentListener.php
public function onPreDelete(ResourceEventInterface $event)
    {
        $payment = $this->getPaymentFromEvent($event);

        // Pre load sale's payments
        $payment->getSale()->getPayments()->toArray();

        if (!in_array($payment->getState(), PaymentStates::getDeletableStates())) {
            throw new IllegalOperationException(); // TODO reason message
        }
    }
public function onPreDelete(ResourceEventInterface $event)
    {
        $payment = $this->getPaymentFromEvent($event);

        // Pre load sale's payments
        $payment->getSale()->getPayments()->toArray();

        if (!in_array($payment->getState(), PaymentStates::getDeletableStates())) {
            throw new IllegalOperationException(); // TODO reason message
        }
    }
public function onPreDelete ( ResourceEventInterface $ event ) { $ payment = $ this -> getPaymentFromEvent ( $ event ) ; // Pre load sale's payments $ payment -> getSale ( ) -> getPayments ( ) -> toArray ( ) ; if ( ! in_array ( $ payment -> getState ( ) , PaymentStates :: getDeletableStates ( ) ) ) { throw new IllegalOperationException ( ) ; // TODO reason message } }
Pre delete event handler.

@param ResourceEventInterface $event

@throws IllegalOperationException
Pre delete event handler .