/** * Function to delete a rule with id * * @param int $ruleId * @throws Exception when ruleId is empty * @access public * @static */ public static function deleteWithId($ruleId) { if (empty($ruleId)) { throw new Exception('rule id can not be empty when attempting to delete a civirule rule'); } CRM_Civirules_BAO_RuleAction::deleteWithRuleId($ruleId); CRM_Civirules_BAO_RuleCondition::deleteWithRuleId($ruleId); $rule = new CRM_Civirules_BAO_Rule(); $rule->id = $ruleId; $rule->delete(); return; }
/** * Function to delete a rule with id * * @param int $ruleId * @throws Exception when ruleId is empty * @access public * @static */ public static function deleteWithId($ruleId) { if (empty($ruleId)) { throw new Exception('rule id can not be empty when attempting to delete a civirule rule'); } CRM_Utils_Hook::pre('delete', 'CiviRuleRule', $ruleId, CRM_Core_DAO::$_nullArray); CRM_Civirules_BAO_RuleAction::deleteWithRuleId($ruleId); CRM_Civirules_BAO_RuleCondition::deleteWithRuleId($ruleId); $rule = new CRM_Civirules_BAO_Rule(); $rule->id = $ruleId; $rule->delete(); CRM_Utils_Hook::post('delete', 'CiviRuleRule', $ruleId, CRM_Core_DAO::$_nullArray); return; }