Example #1
0
function _civicrm_api_get_camel_name($entity, $version = NULL)
{
    if (empty($version)) {
        $version = civicrm_get_api_version();
    }
    $fragments = explode('_', $entity);
    foreach ($fragments as &$fragment) {
        $fragment = ucfirst($fragment);
    }
    // Special case: UFGroup, UFJoin, UFMatch, UFField
    if ($fragments[0] === 'Uf') {
        $fragments[0] = 'UF';
    }
    return implode('', $fragments);
}
function _civicrm_api_get_camel_name($entity, $version = NULL)
{
    static $_map = NULL;
    if (empty($version)) {
        $version = civicrm_get_api_version();
    }
    if (!isset($_map[$version])) {
        $_map[$version]['utils'] = 'utils';
        if ($version === 2) {
            // TODO: Check if $_map needs to contain anything.
            $_map[$version]['contribution'] = 'Contribute';
            $_map[$version]['custom_field'] = 'CustomGroup';
        } else {
            // assume $version == 3.
        }
    }
    if (isset($_map[$version][strtolower($entity)])) {
        return $_map[$version][strtolower($entity)];
    }
    $fragments = explode('_', $entity);
    foreach ($fragments as &$fragment) {
        $fragment = ucfirst($fragment);
    }
    // Special case: UFGroup, UFJoin, UFMatch, UFField
    if ($fragments[0] === 'Uf') {
        $fragments[0] = 'UF';
    }
    return implode('', $fragments);
}