3 +--------------------------------------------------------------------+
4 | Copyright CiviCRM LLC. All rights reserved. |
6 | This work is published under the GNU AGPLv3 license with some |
7 | permitted exceptions and without any warranty. For full license |
8 | and copyright information, see https://civicrm.org/licensing |
9 +--------------------------------------------------------------------+
13 * @package CiviCRM_APIv3
17 * Generic api wrapper used to get all unique fields for a given entity.
19 * @param array $apiRequest
23 function civicrm_api3_generic_getunique($apiRequest) {
24 $entity = _civicrm_api_get_entity_name_from_camel($apiRequest['entity']);
27 $dao = _civicrm_api3_get_DAO($entity);
28 $uFields = $dao::indices();
30 foreach ($uFields as $fieldKey => $field) {
31 if (!isset($field['unique']) ||
!$field['unique']) {
34 $uniqueFields[$fieldKey] = $field['field'];
37 return civicrm_api3_create_success($uniqueFields);