* - object
*
* @return array|int
+ * @throws \CRM_Core_Exception
*/
public function callAPISuccessGetValue($entity, $params, $type = NULL) {
$params += [
];
$result = $this->civicrm_api($entity, 'getvalue', $params);
if (is_array($result) && (!empty($result['is_error']) || isset($result['values']))) {
- throw new \Exception('Invalid getvalue result' . print_r($result, TRUE));
+ throw new \CRM_Core_Exception('Invalid getvalue result' . print_r($result, TRUE));
}
if ($type) {
- if ($type == 'integer') {
+ if ($type === 'integer') {
// api seems to return integers as strings
$this->assertTrue(is_numeric($result), "expected a numeric value but got " . print_r($result, 1));
}
$indexBy = in_array($v3Action, ['get', 'create', 'replace']) && !$sequential ? 'id' : NULL;
$onlyId = !empty($v3Params['format.only_id']);
$onlySuccess = !empty($v3Params['format.is_success']);
- if (!empty($v3Params['filters']['is_current']) || !empty($params['isCurrent'])) {
+ if (!empty($v3Params['filters']['is_current']) || !empty($v3Params['isCurrent'])) {
$v4Params['current'] = TRUE;
}
+ $language = !empty($v3Params['options']['language']) ? $v3Params['options']['language'] : \CRM_Utils_Array::value('option.language', $v3Params);
+ if ($language) {
+ $v4Params['language'] = $language;
+ }
$toRemove = ['option.', 'return', 'api.', 'format.'];
$chains = [];
$custom = [];