$action = strtolower(CRM_Utils_Array::value('action', $apiRequest['params']));
$sequential = empty($apiRequest['params']) ? 0 : 1;
$apiOptions = CRM_Utils_Array::value('options', $apiRequest['params'], array());
- if ($action == 'getvalue' || $action == 'getvalue' || $action == 'getcount') {
+ if (!$action || $action == 'getvalue' || $action == 'getcount') {
$action = 'get';
}
-
- if (empty($action)) {
- $action='get';
- }
// determines whether to use unique field names - seem comment block above
$unique = TRUE;
if (empty($apiOptions) && isset($results[$entity . $subentity]) && isset($action, $results[$entity . $subentity])
// find any supplemental information
$hypApiRequest = array('entity' => $apiRequest['entity'], 'action' => $action, 'version' => $apiRequest['version']);
- $hypApiRequest += _civicrm_api_resolve($hypApiRequest);
- $helper = '_' . $hypApiRequest['function'] . '_spec';
+ try {
+ list ($apiProvider, $hypApiRequest) = \Civi\Core\Container::singleton()->get('civi_api_kernel')->resolve($hypApiRequest);
+ $helper = '_' . $hypApiRequest['function'] . '_spec';
+ } catch (\Civi\API\Exception\NotImplementedException $e) {
+ $helper = NULL;
+ }
if (function_exists($helper)) {
// alter
$helper($metadata, $apiRequest);
$output[] = array('key' => $key, 'value' => $val);
}
}
- return civicrm_api3_create_success($output);
+ return civicrm_api3_create_success($output, $apiRequest['params'], $apiRequest['entity'], 'getoptions');
}
/**
* - the reason for this is that checking / transformation is done on pseudoconstants but
* - if the field is an FK then mysql will enforce the data quality (& we have handling on failure)
* @todo - if may be we should define a 'resolve' key on the psuedoconstant for when these rules are not fine enough
- * 3) if there is an 'enum' then it is split up into the relevant options
*
* This function is only split out for the purpose of code clarity / comment block documentation
* @param array $metadata the array of metadata that will form the result of the getfields function
* @param array $fieldsToResolve anny field resolutions specifically requested
*/
function _civicrm_api3_generic_get_metadata_options(&$metadata, $entity, $fieldname, $fieldSpec, $fieldsToResolve){
- if(empty($fieldSpec['pseudoconstant']) && empty($fieldSpec['enumValues'])) {
+ if (empty($fieldSpec['pseudoconstant'])) {
return;
}