+--------------------------------------------------------------------+
| CiviCRM version 4.6 |
+--------------------------------------------------------------------+
+--------------------------------------------------------------------+
| CiviCRM version 4.6 |
+--------------------------------------------------------------------+
+--------------------------------------------------------------------+
| This file is a part of CiviCRM. |
| |
+--------------------------------------------------------------------+
| This file is a part of CiviCRM. |
| |
| GNU Affero General Public License or the licensing of CiviCRM, |
| see the CiviCRM license FAQ at http://civicrm.org/licensing |
+--------------------------------------------------------------------+
| GNU Affero General Public License or the licensing of CiviCRM, |
| see the CiviCRM license FAQ at http://civicrm.org/licensing |
+--------------------------------------------------------------------+
// First try the obvious replacements
$daoName = str_replace(array('_BAO_', '_Form_', '_Page_'), '_DAO_', $className);
// First try the obvious replacements
$daoName = str_replace(array('_BAO_', '_Form_', '_Page_'), '_DAO_', $className);
list(, $parent, , $child) = explode('_', $className);
$daoName = "CRM_{$parent}_DAO_$child";
list(, $parent, , $child) = explode('_', $className);
$daoName = "CRM_{$parent}_DAO_$child";
- $shortName = CRM_Core_DAO_AllCoreTables::getBriefName($daoName);
+ $entityName = CRM_Core_DAO_AllCoreTables::getBriefName($daoName);
+ }
+
+ // If that didn't work, try using just the trailing name
+ if (!$entityName) {
+ $entityName = CRM_Core_DAO_AllCoreTables::getFullName($child) ? $child : NULL;