/** * Processing object before delete data * * @return $this * @throws \Magento\Framework\Exception\LocalizedException */ public function beforeDelete() { if (!$this->_actionValidator->isAllowed($this)) { throw new \Magento\Framework\Exception\LocalizedException(new \Magento\Framework\Phrase('Delete operation is forbidden for current area')); } $this->_eventManager->dispatch('model_delete_before', ['object' => $this]); $this->_eventManager->dispatch($this->_eventPrefix . '_delete_before', $this->_getEventData()); $this->cleanModelCache(); return $this; }
/** * Processing object before delete data * * @return $this * @throws Exception */ protected function _beforeDelete() { if (!$this->_actionValidator->isAllowed($this)) { throw new Exception(__('Delete operation is forbidden for current area')); } $this->_eventManager->dispatch('model_delete_before', array('object' => $this)); $this->_eventManager->dispatch($this->_eventPrefix . '_delete_before', $this->_getEventData()); $this->cleanModelCache(); return $this; }