entityGrid = $entityGrid; } /** * Handles synchronous removing of the entity from * corresponding grid on certain events. * * Used in the next events: * * - sales_order_delete_after * - sales_order_invoice_delete_after * - sales_order_shipment_delete_after * - sales_order_creditmemo_delete_after * * @param \Magento\Framework\Event\Observer $observer * @return void */ public function execute(\Magento\Framework\Event\Observer $observer) { $this->entityGrid->purge($observer->getDataObject()->getId()); } }