X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=api%2Fapi.php;h=be1946db3735796f65dd091d9d3aece9908d98e6;hb=0b396f84a77e2a129688af732a6233c20b799340;hp=8208af08db30d36f42b8a9e653f983f18bd69e62;hpb=94ca1b202d6607a7f207bc0cd4ecc470fe53e3eb;p=civicrm-core.git diff --git a/api/api.php b/api/api.php index 8208af08db..be1946db37 100644 --- a/api/api.php +++ b/api/api.php @@ -281,33 +281,25 @@ function _civicrm_api_replace_variable($value, $parentResult, $separator) { * * @return string * Entity name in underscore separated format. + * + * @deprecated */ function _civicrm_api_get_entity_name_from_camel($entity) { - if (!$entity || $entity === strtolower($entity)) { - return $entity; - } - elseif ($entity == 'PCP') { - return 'pcp'; - } - else { - $entity = ltrim(strtolower(str_replace('U_F', - 'uf', - // That's CamelCase, beside an odd UFCamel that is expected as uf_camel - preg_replace('/(?=[A-Z])/', '_$0', $entity) - )), '_'); + if (!$entity) { + // @todo - this should not be called when empty. + return ''; } - return $entity; + return CRM_Core_DAO_AllCoreTables::convertEntityNameToLower($entity); } /** * Having a DAO object find the entity name. * - * @param object $bao + * @param CRM_Core_DAO $bao * DAO being passed in. * * @return string */ function _civicrm_api_get_entity_name_from_dao($bao) { - $daoName = str_replace("BAO", "DAO", get_class($bao)); - return CRM_Core_DAO_AllCoreTables::getBriefName($daoName); + return CRM_Core_DAO_AllCoreTables::getBriefName(get_class($bao)); }