54 \
Magento\Framework\Api\ExtensionAttributesFactory $extensionFactory,
70 $this->_classFactory = $classFactory;
89 if (!$this->
getId()) {
93 $typeModel = $this->_classFactory->create($this);
95 if ($typeModel->getAssignedToRules()->getSize() > 0) {
98 'You cannot delete this tax class because it is used in Tax Rules.' 99 .
' You have to delete the rules it is used in first.' 104 if ($typeModel->isAssignedToObjects()) {
107 'You cannot delete this tax class because it is used in existing %1(s).',
108 $typeModel->getObjectTypeName()
125 return parent::beforeDelete();
134 return $this->
getData(self::KEY_ID);
142 return $this->
getData(self::KEY_NAME);
150 return $this->
getData(self::KEY_TYPE);
161 return $this->
setData(self::KEY_ID, $classId);
183 return $this->
setData(self::KEY_TYPE, $classType);
setExtensionAttributes(\Magento\Tax\Api\Data\TaxClassExtensionInterface $extensionAttributes)
const TAX_CLASS_TYPE_CUSTOMER
_getExtensionAttributes()
_setExtensionAttributes(\Magento\Framework\Api\ExtensionAttributesInterface $extensionAttributes)
getData($key='', $index=null)
setData($key, $value=null)
const TAX_CLASS_TYPE_PRODUCT
__construct(\Magento\Framework\Model\Context $context, \Magento\Framework\Registry $registry, \Magento\Framework\Api\ExtensionAttributesFactory $extensionFactory, AttributeValueFactory $customAttributeFactory, \Magento\Tax\Model\TaxClass\Factory $classFactory, \Magento\Framework\Model\ResourceModel\AbstractResource $resource=null, \Magento\Framework\Data\Collection\AbstractDb $resourceCollection=null, array $data=[])