From 8268052f9614fb7dcfb9c5cd76c967047bc769b5 Mon Sep 17 00:00:00 2001 From: eileen Date: Thu, 2 Feb 2017 09:44:26 +1300 Subject: [PATCH] CRM-19953 only get (potentially slow) entity data if return not set --- api/v3/PriceSet.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/api/v3/PriceSet.php b/api/v3/PriceSet.php index b31ced3848..b7b15e6019 100644 --- a/api/v3/PriceSet.php +++ b/api/v3/PriceSet.php @@ -91,9 +91,11 @@ function civicrm_api3_price_set_get($params) { return _civicrm_api3_basic_get(_civicrm_api3_get_BAO(__FUNCTION__), $params); } $result = _civicrm_api3_basic_get(_civicrm_api3_get_BAO(__FUNCTION__), $params, FALSE); - // Fetch associated entities - foreach ($result as &$item) { - $item['entity'] = CRM_Price_BAO_PriceSet::getUsedBy($item['id'], 'entity'); + // Fetch associated entities if the return has not been previously limited. + if (!isset($params['return'])) { + foreach ($result as &$item) { + $item['entity'] = CRM_Price_BAO_PriceSet::getUsedBy($item['id'], 'entity'); + } } return civicrm_api3_create_success($result, $params); } -- 2.25.1