You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Feb 24, 2020. It is now read-only.
@eileenmcnaughton I'm not a big fan of that; I'm worried that removeWhere would get confused with addWhere('NOT', ...) which is a thing. Technically you can setWhere to a different value, so maybe the most readable version of this code would be:
$contributionWhereClause = [
['contribution_recur_id', '=', $id],
['is_test', '=', $is_test],
];
$contributionApi = \Civi\Api4\Contribution::get()
->setWhere($contributionWhereClause)
->addWhere('is_template', '=', 1)
->addOrderBy('id', 'DESC')
->setLimit(1);
// First look for new-style template contribution with is_template=1$templateContributions = $contributionApi->execute();
if (!$templateContributions->count()) {
// Fall back to old style template contributions without is_template$templateContributions = $contributionApi->setWhere($contributionWhereClause)->execute();
}
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
I'm just looking at this code
https://github.com/civicrm/civicrm-core/pull/15456/files#diff-eba7056035c65245b5dd9bf4ccac8fe4R437
Which does 2 api calls with the same parameters except one less the second time - a 'removeWhere' would make it shorter....
@colemanw @totten any ideas on nice ways here?
The text was updated successfully, but these errors were encountered: