Add redundant contact_id field for search kit/form builder; add index on category field...

This commit is contained in:
Rich Lott / Artful Robot 2024-02-28 17:18:46 +00:00
parent 9fee48603b
commit 7b611c343f
7 changed files with 113 additions and 29 deletions

View file

@ -6,7 +6,7 @@
*
* Generated from contactcats/xml/schema/CRM/Contactcats/ContactCategory.xml
* DO NOT EDIT. Generated by CRM_Core_CodeGen
* (GenCodeChecksum:01a6344ef3d86c080e4362dafa008d13)
* (GenCodeChecksum:222d053743f68a2678d92b8a75b46316)
*/
use CRM_Contactcats_ExtensionUtil as E;
@ -40,6 +40,15 @@ class CRM_Contactcats_DAO_ContactCategory extends CRM_Core_DAO {
*/
public $id;
/**
* Same as id but for FormBuilder
*
* @var int|string
* (SQL type: int unsigned)
* Note that values will be retrieved from the database as a string.
*/
public $contact_id;
/**
* @var int|string
* (SQL type: int unsigned)
@ -97,12 +106,34 @@ class CRM_Contactcats_DAO_ContactCategory extends CRM_Core_DAO {
'entity' => 'ContactCategory',
'bao' => 'CRM_Contactcats_DAO_ContactCategory',
'localizable' => 0,
'html' => [
'type' => 'Number',
],
'readonly' => TRUE,
'add' => NULL,
],
'contact_id' => [
'name' => 'contact_id',
'type' => CRM_Utils_Type::T_INT,
'title' => E::ts('Contact ID'),
'description' => E::ts('Same as id but for FormBuilder'),
'required' => TRUE,
'usage' => [
'import' => FALSE,
'export' => FALSE,
'duplicate_matching' => FALSE,
'token' => FALSE,
],
'where' => 'civicrm_contact_category.contact_id',
'table_name' => 'civicrm_contact_category',
'entity' => 'ContactCategory',
'bao' => 'CRM_Contactcats_DAO_ContactCategory',
'localizable' => 0,
'FKClassName' => 'CRM_Contact_DAO_Contact',
'html' => [
'type' => 'EntityRef',
'label' => E::ts("Contact"),
],
'readonly' => TRUE,
'add' => NULL,
],
'category' => [
@ -192,7 +223,16 @@ class CRM_Contactcats_DAO_ContactCategory extends CRM_Core_DAO {
* @return array
*/
public static function indices($localize = TRUE) {
$indices = [];
$indices = [
'index_category' => [
'name' => 'index_category',
'field' => [
0 => 'category',
],
'localizable' => FALSE,
'sig' => 'civicrm_contact_category::0::category',
],
];
return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
}