Skip to content

Commit

Permalink
Deprecate no return on activity get
Browse files Browse the repository at this point in the history
It turns out that the area most causey of civicrm#18968
is activity get calls with no 'return' - which should be less that the contact.get
ones so trying to deprecate no-return
  • Loading branch information
eileenmcnaughton committed Jun 17, 2021
1 parent 68bb934 commit bdae367
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
1 change: 1 addition & 0 deletions Civi/Test/Api3TestTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ public function callAPISuccess($entity, $action, $params = [], $checkAgainst = N
$params = array_merge([
'version' => $this->_apiversion,
'debug' => 1,
'return' => 'id',
],
$params
);
Expand Down
5 changes: 4 additions & 1 deletion api/v3/Activity.php
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,10 @@ function civicrm_api3_activity_get($params) {
$options['return']['status_id'] = $options['return']['activity_date_time'] = 1;
$params['return'] = array_keys($options['return']);
}

if (!isset($params['return']) && !$options['is_count']) {
// https://github.com/civicrm/civicrm-core/pull/18968
CRM_Core_Error::deprecatedWarning('Not setting a return array is deprecated as it will fail on complex sites.');
}
$activities = _civicrm_api3_basic_get(_civicrm_api3_get_BAO(__FUNCTION__), $params, FALSE, 'Activity', $sql);
if ($options['is_count']) {
return civicrm_api3_create_success($activities, $params, 'Activity', 'get');
Expand Down
2 changes: 1 addition & 1 deletion phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false"
stopOnFailure="true"
stderr="true"
beStrictAboutTestsThatDoNotTestAnything="false"
bootstrap="tests/phpunit/CiviTest/bootstrap.php"
Expand Down

0 comments on commit bdae367

Please sign in to comment.