Updating extensions for 4.7

Published
2016-02-22 17:45
Written by

Using extensions on 4.7 I discovered that if you add entities but don't define them via hook you can get errors.

 

So, if you have an extension that defines entities you need a hook like the one below

 

/**
 * Implements hook_civicrm_entityTypes.
 *
 * @param array $entityTypes
 *   Registered entity types.
 */
function accountsync_civicrm_entityTypes(&$entityTypes) {
  $entityTypes['CRM_Accountsync_DAO_AccountContact'] = array(
    'name' => 'AccountContact',
    'class' => 'CRM_Accountsync_DAO_AccountContact',
    'table' => 'civicrm_account_contact',
  );
  $entityTypes['CRM_Accountsync_DAO_AccountInvoice'] = array(
    'name' => 'AccountInvoice',
    'class' => 'CRM_Accountsync_DAO_AccountInvoice',
    'table' => 'civicrm_account_invoice',
  );
}
Filed under