systopia / Custom-Data-Helper

Helper class for CiviCRM Extensions
GNU Affero General Public License v3.0
0 stars 0 forks source link

Use APIv4 (if available) #2

Open jensschuppe opened 2 years ago

jensschuppe commented 2 years ago

... instead of civicrm_api3(), see the docs.

jensschuppe commented 2 years ago

@bjendres "if available" as in "if on a recent Core version"?

I think this code is basically being employed for new projects anyway, so why should APIv4 not be available for CustomGroup, OptionGroup, etc.? This would ideally be a new "version" with the APIv3 "version" being deprecated - agree?

bjendres commented 2 years ago

@bjendres "if available" as in "if on a recent Core version"?

Yes. Keep in mind that some clients run old civicrm version behind firewalls, since upgrading their heavily customised deployment take a lot of money and time to be upgraded to the next core version. And since a simple "if not available" switch costs us next to nothing... why not?

jensschuppe commented 2 years ago

Well, I'd rather go for a new branch then, but that's bikeshedding.

Those switches would look like what? Checking for function_exists('civicrm_api4')? That might be insufficient for old unstable APIv4 versions being installed. Maybe a Core version check?

Anyway, that's nothing near to urgent.

bjendres commented 2 years ago

Anyway, that's nothing near to urgent.

I agree. Could be patched back in for their version anyway.