Can't create a relationship with CiviMember disabled
When creating a relationship via the "Add Relationship" UI, Civi crashes if CiviMember is disabled.
Steps to Replicate
- Disable CiviMember.
- Add a relationship by pressing the Add Relationship button on the Relationships tab.
Expected Result
Relationship added, no error.
Actual Result
Relationship is added, but with error Key id not found in api results
(in Civi 5.45) or MembershipType API is not available because CiviMember component is disabled
(Civi 5.47).
This is a regression introduced in 5.43 by PR 21803. Post-save, Civi tries to calculate the membership/contribution counts to display on the contact tab. CRM_Contact_BAO_Contact::getCountComponent()
attempts to look up the count using API4, but without regard for whether that entity is present.