Eileen has uploaded a new change for review.
https://gerrit.wikimedia.org/r/277355
Change subject: CRM-18213 remove hard-coding of DAO names
......................................................................
CRM-18213 remove hard-coding of DAO names
Merged into 4.7
Change-Id: I37facda0a751da0e52ca47c595f067df78658a47
---
M CRM/Logging/Differ.php
1 file changed, 2 insertions(+), 19 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/crm/civicrm
refs/changes/55/277355/1
diff --git a/CRM/Logging/Differ.php b/CRM/Logging/Differ.php
index 7a5acb2..118726c 100644
--- a/CRM/Logging/Differ.php
+++ b/CRM/Logging/Differ.php
@@ -257,25 +257,8 @@
static $titles = array();
static $values = array();
- // FIXME: split off the table → DAO mapping to a GenCode-generated class
- static $daos = array(
- 'civicrm_address' => 'CRM_Core_DAO_Address',
- 'civicrm_contact' => 'CRM_Contact_DAO_Contact',
- 'civicrm_email' => 'CRM_Core_DAO_Email',
- 'civicrm_im' => 'CRM_Core_DAO_IM',
- 'civicrm_openid' => 'CRM_Core_DAO_OpenID',
- 'civicrm_phone' => 'CRM_Core_DAO_Phone',
- 'civicrm_website' => 'CRM_Core_DAO_Website',
- 'civicrm_contribution' => 'CRM_Contribute_DAO_Contribution',
- 'civicrm_note' => 'CRM_Core_DAO_Note',
- 'civicrm_relationship' => 'CRM_Contact_DAO_Relationship',
- 'civicrm_activity' => 'CRM_Activity_DAO_Activity',
- 'civicrm_case' => 'CRM_Case_DAO_Case',
- );
-
if (!isset($titles[$table]) or !isset($values[$table])) {
-
- if (in_array($table, array_keys($daos))) {
+ if (($tableDAO = CRM_Core_DAO_AllCoreTables::getClassForTable($table))
!= FALSE) {
// FIXME: these should be populated with pseudo constants as they
// were at the time of logging rather than their current values
// FIXME: Use *_BAO:buildOptions() method rather than pseudoconstants
& fetch programmatically
@@ -311,7 +294,7 @@
break;
}
- $dao = new $daos[$table]();
+ $dao = new $tableDAO();
foreach ($dao->fields() as $field) {
$titles[$table][$field['name']] = CRM_Utils_Array::value('title',
$field);
--
To view, visit https://gerrit.wikimedia.org/r/277355
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I37facda0a751da0e52ca47c595f067df78658a47
Gerrit-PatchSet: 1
Gerrit-Project: wikimedia/fundraising/crm/civicrm
Gerrit-Branch: master
Gerrit-Owner: Eileen <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits