Skip to content

Commit

Permalink
CRM-19953 only get (potentially slow) entity data if return not set
Browse files Browse the repository at this point in the history
  • Loading branch information
eileenmcnaughton committed Feb 1, 2017
1 parent 9d8f190 commit 8268052
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions api/v3/PriceSet.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down

0 comments on commit 8268052

Please sign in to comment.