* @return array|int
*/
function civicrm_api($entity, $action, $params, $extra = NULL) {
- return \Civi\Core\Container::singleton()->get('civi_api_kernel')->run($entity, $action, $params, $extra);
+ return \Civi::service('civi_api_kernel')->runSafe($entity, $action, $params, $extra);
}
/**
*/
function civicrm_api3($entity, $action, $params = array()) {
$params['version'] = 3;
- $result = civicrm_api($entity, $action, $params);
+ $result = \Civi::service('civi_api_kernel')->runSafe($entity, $action, $params);
if (is_array($result) && !empty($result['is_error'])) {
throw new CiviCRM_API3_Exception($result['error_message'], CRM_Utils_Array::value('error_code', $result, 'undefined'), $result);
}
if (!$entity || $entity === strtolower($entity)) {
return $entity;
}
+ elseif ($entity == 'PCP') {
+ return 'pcp';
+ }
else {
$entity = ltrim(strtolower(str_replace('U_F',
'uf',