X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=api%2Fv3%2FEntityTag.php;h=d0e20831e69cdd10ce225d72cf8aca1022d34f83;hb=85bb0909cffd925f4cd5c0022a68a1ff74d3ad8e;hp=1ffe6d5f399a8abfb154e7344a6aad530a94f202;hpb=4d32d50b462d76a14faf7a6f732816ee9fe40ee6;p=civicrm-core.git diff --git a/api/v3/EntityTag.php b/api/v3/EntityTag.php index 1ffe6d5f39..d0e20831e6 100644 --- a/api/v3/EntityTag.php +++ b/api/v3/EntityTag.php @@ -2,9 +2,9 @@ /* +--------------------------------------------------------------------+ - | CiviCRM version 4.3 | + | CiviCRM version 4.5 | +--------------------------------------------------------------------+ - | Copyright CiviCRM LLC (c) 2004-2013 | + | Copyright CiviCRM LLC (c) 2004-2014 | +--------------------------------------------------------------------+ | This file is a part of CiviCRM. | | | @@ -32,7 +32,7 @@ * @package CiviCRM_APIv3 * @subpackage API_EntityTag * - * @copyright CiviCRM LLC (c) 2004-2013 + * @copyright CiviCRM LLC (c) 2004-2014 * @version $Id: EntityTag.php 30879 2010-11-22 15:45:55Z shot $ */ @@ -50,13 +50,18 @@ */ function civicrm_api3_entity_tag_get($params) { - - $values = CRM_Core_BAO_EntityTag::getTag($params['entity_id'], $params['entity_table']); - $result = array(); - foreach ($values as $v) { - $result[$v] = array('tag_id' => $v); + if(empty($params['entity_id'])) { + return _civicrm_api3_basic_get(_civicrm_api3_get_BAO(__FUNCTION__), $params); + } + else{ + //do legacy non-standard behaviour + $values = CRM_Core_BAO_EntityTag::getTag($params['entity_id'], $params['entity_table']); + $result = array(); + foreach ($values as $v) { + $result[$v] = array('tag_id' => $v); + } + return civicrm_api3_create_success($result, $params); } - return civicrm_api3_create_success($result, $params); } /** @@ -66,7 +71,6 @@ function civicrm_api3_entity_tag_get($params) { * @param array $params array or parameters determined by getfields */ function _civicrm_api3_entity_tag_get_spec(&$params) { - $params['entity_id']['api.required'] = 1; $params['entity_id']['api.aliases'] = array('contact_id'); $params['entity_table']['api.default'] = 'civicrm_contact'; } @@ -107,9 +111,9 @@ function _civicrm_api3_entity_tag_delete_spec(&$params) { /** * * @param $params - * @param $op + * @param string $op * - * @return + * @return array */ function _civicrm_api3_entity_tag_common($params, $op = 'add') {