5 * @copyright CiviCRM LLC https://civicrm.org/licensing
7 * Generated from xml/schema/CRM/Case/CaseContact.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:882177c38c507306b2a456e4cf0303fa)
13 * Database access object for the CaseContact entity.
15 class CRM_Case_DAO_CaseContact
extends CRM_Core_DAO
{
18 * Static instance to hold the table name.
22 public static $_tableName = 'civicrm_case_contact';
25 * Should CiviCRM log any modifications to this table in the civicrm_log table.
29 public static $_log = TRUE;
32 * Unique case-contact association id
39 * Case ID of case-contact association.
46 * Contact ID of contact record given case belongs to.
55 public function __construct() {
56 $this->__table
= 'civicrm_case_contact';
57 parent
::__construct();
61 * Returns foreign keys and entity references.
64 * [CRM_Core_Reference_Interface]
66 public static function getReferenceColumns() {
67 if (!isset(Civi
::$statics[__CLASS__
]['links'])) {
68 Civi
::$statics[__CLASS__
]['links'] = static::createReferenceColumns(__CLASS__
);
69 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'case_id', 'civicrm_case', 'id');
70 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'contact_id', 'civicrm_contact', 'id');
71 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'links_callback', Civi
::$statics[__CLASS__
]['links']);
73 return Civi
::$statics[__CLASS__
]['links'];
77 * Returns all the column names of this table
81 public static function &fields() {
82 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
83 Civi
::$statics[__CLASS__
]['fields'] = [
86 'type' => CRM_Utils_Type
::T_INT
,
87 'title' => ts('Case Contact ID'),
88 'description' => ts('Unique case-contact association id'),
90 'where' => 'civicrm_case_contact.id',
91 'table_name' => 'civicrm_case_contact',
92 'entity' => 'CaseContact',
93 'bao' => 'CRM_Case_BAO_CaseContact',
98 'type' => CRM_Utils_Type
::T_INT
,
99 'title' => ts('Case'),
100 'description' => ts('Case ID of case-contact association.'),
102 'where' => 'civicrm_case_contact.case_id',
103 'table_name' => 'civicrm_case_contact',
104 'entity' => 'CaseContact',
105 'bao' => 'CRM_Case_BAO_CaseContact',
107 'FKClassName' => 'CRM_Case_DAO_Case',
110 'name' => 'contact_id',
111 'type' => CRM_Utils_Type
::T_INT
,
112 'title' => ts('Contact ID'),
113 'description' => ts('Contact ID of contact record given case belongs to.'),
115 'where' => 'civicrm_case_contact.contact_id',
116 'table_name' => 'civicrm_case_contact',
117 'entity' => 'CaseContact',
118 'bao' => 'CRM_Case_BAO_CaseContact',
120 'FKClassName' => 'CRM_Contact_DAO_Contact',
122 'type' => 'EntityRef',
126 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
128 return Civi
::$statics[__CLASS__
]['fields'];
132 * Return a mapping from field-name to the corresponding key (as used in fields()).
135 * Array(string $name => string $uniqueName).
137 public static function &fieldKeys() {
138 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
139 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
141 return Civi
::$statics[__CLASS__
]['fieldKeys'];
145 * Returns the names of this table
149 public static function getTableName() {
150 return self
::$_tableName;
154 * Returns if this table needs to be logged
158 public function getLog() {
163 * Returns the list of fields that can be imported
165 * @param bool $prefix
169 public static function &import($prefix = FALSE) {
170 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'case_contact', $prefix, []);
175 * Returns the list of fields that can be exported
177 * @param bool $prefix
181 public static function &export($prefix = FALSE) {
182 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'case_contact', $prefix, []);
187 * Returns the list of indices
189 * @param bool $localize
193 public static function indices($localize = TRUE) {
195 'UI_case_contact_id' => [
196 'name' => 'UI_case_contact_id',
201 'localizable' => FALSE,
203 'sig' => 'civicrm_case_contact::1::case_id::contact_id',
206 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;