// we do this before we
_civicrm_api3_swap_out_aliases($apiRequest);
if (strtolower($action) != 'getfields') {
- if (!CRM_Utils_Array::value('id', $params)) {
+ if (!CRM_Utils_Array::value('id', $apiRequest['params'])) {
$apiRequest['params'] = array_merge(_civicrm_api3_getdefaults($apiRequest), $apiRequest['params']);
}
//if 'id' is set then only 'version' will be checked but should still be checked for consistency
'api/v' . $apiRequest['version'] . '/' . $camelName . '/' . $actionCamelName . '.php',
);
foreach ($stdFiles as $stdFile) {
- require_once 'CRM/Utils/File.php';
if (CRM_Utils_File::isIncludable($stdFile)) {
require_once $stdFile;
if (function_exists($stdFunction)) {
'api/v' . $apiRequest['version'] . '/Generic/' . $actionCamelName . '.php',
);
foreach ($genericFiles as $genericFile) {
- require_once 'CRM/Utils/File.php';
if (CRM_Utils_File::isIncludable($genericFile)) {
require_once $genericFile;
if (function_exists($genericFunction)) {
$camelName = _civicrm_api_get_camel_name($entity, $version);
// Check for master entity file; to match _civicrm_api_resolve(), only load the first one
- require_once 'CRM/Utils/File.php';
$stdFile = 'api/v' . $version . '/' . $camelName . '.php';
if (CRM_Utils_File::isIncludable($stdFile)) {
require_once $stdFile;
}
function _civicrm_api_get_camel_name($entity, $version = NULL) {
- static $_map = NULL;
-
if (empty($version)) {
$version = civicrm_get_api_version();
}
- if (isset($_map[$version][strtolower($entity)])) {
- return $_map[$version][strtolower($entity)];
- }
-
$fragments = explode('_', $entity);
foreach ($fragments as & $fragment) {
$fragment = ucfirst($fragment);
*
* @param string $entity entity name in various formats e.g. Contribution, contribution, OptionValue, option_value, UFJoin, uf_join
* @return string $entity entity name in underscore separated format
+ *
+ * FIXME: Why isn't this called first thing in civicrm_api wrapper?
*/
function _civicrm_api_get_entity_name_from_camel($entity) {
if ($entity == strtolower($entity)) {
*/
function _civicrm_api_get_entity_name_from_dao($bao){
$daoName = str_replace("BAO", "DAO", get_class($bao));
- $dao = array();
- require ('CRM/Core/DAO/listAll.php');
- $daos = array_flip($dao);
- return _civicrm_api_get_entity_name_from_camel($daos[$daoName]);
-
+ return _civicrm_api_get_entity_name_from_camel(CRM_Core_DAO_AllCoreTables::getBriefName($daoName));
}
-
/**
* Sets the tsLocale and dbLocale for multi-lingual sites.
* Some code duplication from CRM/Core/BAO/ConfigSetting.php retrieve()