Bundle support for CiviCRM Contact

Created on 9 August 2023, 11 months ago
Updated 25 April 2024, about 2 months ago

Problem/Motivation

CiviCRM Event got bundles by specifying event_type_id field.
Why CiviCRM Contact entity can't support bundles based on the type such as Individual, Household and Organization?

I could see ./src/SupportedEntities.php, these types are listed in getEntityType, but all points to Contact and in getInfo() Contact doesn't have bundle property.

Workaround:

/**
 * Implements hook_entity_type_alter().
 */
function custom_entity_type_alter(array &$entity_types) {
  if (isset($entity_types['civicrm_contact'])) {
    $entity_types['civicrm_contact']->set('civicrm_bundle_property', 'contact_type');
    $entity_types['civicrm_contact']->set('entity_keys', [
      'id' => 'id',
      'bundle' => 'bundle',
    ]);
  }
}
✨ Feature request
Status

Postponed

Version

3.5

Component

Code

Created by

πŸ‡¬πŸ‡§United Kingdom kenorb

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.69.0 2024