From 323390ce999b58165eb281b823f2eff13f55b044 Mon Sep 17 00:00:00 2001 From: eileen Date: Wed, 17 Jul 2019 16:01:33 +1200 Subject: [PATCH] Remove exportComponent function - it's not adding much here --- CRM/Export/BAO/Export.php | 44 +++++++-------------------------------- 1 file changed, 8 insertions(+), 36 deletions(-) diff --git a/CRM/Export/BAO/Export.php b/CRM/Export/BAO/Export.php index 61d1ca5395..4aa7ae94d2 100644 --- a/CRM/Export/BAO/Export.php +++ b/CRM/Export/BAO/Export.php @@ -41,40 +41,6 @@ class CRM_Export_BAO_Export { // CRM-7675 const EXPORT_ROW_COUNT = 100000; - /** - * Get Export component - * - * @param int $exportMode - * Export mode. - * - * @return string - * CiviCRM Export Component - */ - public static function exportComponent($exportMode) { - switch ($exportMode) { - case CRM_Export_Form_Select::CONTRIBUTE_EXPORT: - $component = 'civicrm_contribution'; - break; - - case CRM_Export_Form_Select::EVENT_EXPORT: - $component = 'civicrm_participant'; - break; - - case CRM_Export_Form_Select::MEMBER_EXPORT: - $component = 'civicrm_membership'; - break; - - case CRM_Export_Form_Select::PLEDGE_EXPORT: - $component = 'civicrm_pledge'; - break; - - case CRM_Export_Form_Select::GRANT_EXPORT: - $component = 'civicrm_grant'; - break; - } - return $component; - } - /** * Get the list the export fields. * @@ -617,13 +583,19 @@ LIMIT $offset, $limit } return $relIDs; } - $component = self::exportComponent($exportMode); + $componentMapping = [ + CRM_Export_Form_Select::CONTRIBUTE_EXPORT => 'civicrm_contribution', + CRM_Export_Form_Select::EVENT_EXPORT => 'civicrm_participant', + CRM_Export_Form_Select::MEMBER_EXPORT => 'civicrm_membership', + CRM_Export_Form_Select::PLEDGE_EXPORT => 'civicrm_pledge', + CRM_Export_Form_Select::GRANT_EXPORT => 'civicrm_grant', + ]; if ($exportMode == CRM_Export_Form_Select::CASE_EXPORT) { return CRM_Case_BAO_Case::retrieveContactIdsByCaseId($ids); } else { - return CRM_Core_DAO::getContactIDsFromComponent($ids, $component); + return CRM_Core_DAO::getContactIDsFromComponent($ids, $componentMapping[$exportMode]); } } -- 2.25.1