/** * Remove given VAT type and all references to it. * * Drops VAT charging rules referencing the VAT type. * Resets VAT type in associated products to its default value for a product class. * * \param $vatID id of VAT type to remove. * \public * \static */ function removeThis() { $vatID = $this->ID; $db = eZDB::instance(); $db->begin(); // remove dependent VAT rules $dependentRules = eZVatRule::fetchByVatType($vatID); foreach ($dependentRules as $rule) { eZVatRule::removeVatRule($rule->attribute('id')); } // replace VAT type in dependent products. eZVatType::resetToDefaultInProducts($vatID); // Remove the VAT type itself. eZPersistentObject::removeObject(eZVatType::definition(), array("id" => $vatID)); $db->commit(); }