From 23474ab300e2325d19608a958305f7186fcf0a16 Mon Sep 17 00:00:00 2001 From: Coleman Watts Date: Mon, 24 Mar 2014 16:52:30 -0400 Subject: [PATCH] Allow nonstandard apis to declare their dao --- api/v3/utils.php | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) 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; } /** -- 2.25.1