0

I am trying to fix problems in an extension that relies on the deprecated (now removed) CRM_Core_OptionGroup::getValue but am unsure of the details of the new code.

The Developed Docs give useful details of the suggested replacement, e.g. (CRM_Core_PseudoConstant::getKey('CRM_Contribute_BAO_Contribution', 'contribution_status', 'Completed')): https://docs.civicrm.org/dev/en/latest/framework/pseudoconstant/

  • How do I identify the relevant BAO name for this, however?
  • And what is the appropriate replacement for CRM_Core_OptionGroup::values('from_email_address', NULL, NULL, NULL);?

Is there any developer documentation about how to replace deprecated methods in general?

1 Answer 1

1

You can use API4 to fetch the Options or value of the option

$optionValue = \Civi\Api4\OptionValue::get()
  ->addSelect('value')
  ->addWhere('name', '=', 'Completed')
  ->addWhere('option_group_id:name', '=', 'contribution_status')
  ->execute()
  ->first()['value'];

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.