Supplier/EventListener/SupplierDeliveryListener.php
public function onPreDelete(ResourceEventInterface $event)
    {
        $delivery = $this->getSupplierDeliveryFromEvent($event);

        $this->assertDeletable($delivery);

        // Initialize the supplier order's deliveries collection before the delivery removal.
        // @see http://stackoverflow.com/questions/41102378/scheduled-entity-in-onflush-is-different-instance#answer-41361138
        $delivery->getOrder()->getDeliveries()->count();
    }
public function onPreDelete(ResourceEventInterface $event)
    {
        $delivery = $this->getSupplierDeliveryFromEvent($event);

        $this->assertDeletable($delivery);

        // Initialize the supplier order's deliveries collection before the delivery removal.
        // @see http://stackoverflow.com/questions/41102378/scheduled-entity-in-onflush-is-different-instance#answer-41361138
        $delivery->getOrder()->getDeliveries()->count();
    }
Pre delete event handler.

@param ResourceEventInterface $event

@throws Exception\IllegalOperationException