/** * Processing object before save data * * @return \Magento\Framework\Model\AbstractModel * @throws \Magento\Eav\Exception */ protected function _beforeSave() { try { $this->attrLockValidator->validate($this); } catch (\Magento\Framework\Model\Exception $exception) { throw new \Magento\Eav\Exception($exception->getMessage()); } $this->setData('modulePrefix', self::MODULE_NAME); return parent::_beforeSave(); }
/** * Processing object before save data * * @return \Magento\Framework\Model\AbstractModel * @throws \Magento\Framework\Model\Exception */ protected function _beforeSave() { $this->setData('modulePrefix', self::MODULE_NAME); if (isset($this->_origData['is_global'])) { if (!isset($this->_data['is_global'])) { $this->_data['is_global'] = self::SCOPE_GLOBAL; } if ($this->_data['is_global'] != $this->_origData['is_global']) { try { $this->attrLockValidator->validate($this); } catch (\Magento\Framework\Model\Exception $exception) { throw new \Magento\Framework\Model\Exception(__('Do not change the scope. ' . $exception->getMessage())); } } } if ($this->getFrontendInput() == 'price') { if (!$this->getBackendModel()) { $this->setBackendModel('Magento\\Catalog\\Model\\Product\\Attribute\\Backend\\Price'); } } if ($this->getFrontendInput() == 'textarea') { if ($this->getIsWysiwygEnabled()) { $this->setIsHtmlAllowedOnFront(1); } } return parent::_beforeSave(); }