From: Coleman Watts Date: Mon, 24 Mar 2014 20:52:30 +0000 (-0400) Subject: Allow nonstandard apis to declare their dao X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=23474ab300e2325d19608a958305f7186fcf0a16;p=civicrm-core.git Allow nonstandard apis to declare their dao --- diff --git a/api/v3/utils.php b/api/v3/utils.php index 942df007a6..993791cf6b 100644 --- a/api/v3/utils.php +++ b/api/v3/utils.php @@ -318,7 +318,19 @@ function _civicrm_api3_get_DAO($name) { if ($name == 'Im' || $name == 'Acl') { $name = strtoupper($name); } - return CRM_Core_DAO_AllCoreTables::getFullName($name); + $dao = CRM_Core_DAO_AllCoreTables::getFullName($name); + if ($dao) { + return $dao; + } + + // Really weird apis can declare their own DAO name. Not sure if this is a good idea... + include_once "api/v3/$name.php"; + $daoFn = "_civicrm_api3_" . _civicrm_api_get_entity_name_from_camel($name) . "_DAO"; + if (function_exists($daoFn)) { + return $daoFn(); + } + + return NULL; } /**