Merge pull request #15734 from seamuslee001/remove_activity_option_join_custom_search
[civicrm-core.git] / CRM / Case / DAO / CaseContact.php
1 <?php
2
3 /**
4 * @package CRM
5 * @copyright CiviCRM LLC https://civicrm.org/licensing
6 *
7 * Generated from xml/schema/CRM/Case/CaseContact.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:57c510f7c1c0eb55f8452035a5ecc472)
10 */
11
12 /**
13 * Database access object for the CaseContact entity.
14 */
15 class CRM_Case_DAO_CaseContact extends CRM_Core_DAO {
16
17 /**
18 * Static instance to hold the table name.
19 *
20 * @var string
21 */
22 public static $_tableName = 'civicrm_case_contact';
23
24 /**
25 * Should CiviCRM log any modifications to this table in the civicrm_log table.
26 *
27 * @var bool
28 */
29 public static $_log = TRUE;
30
31 /**
32 * Unique case-contact association id
33 *
34 * @var int
35 */
36 public $id;
37
38 /**
39 * Case ID of case-contact association.
40 *
41 * @var int
42 */
43 public $case_id;
44
45 /**
46 * Contact ID of contact record given case belongs to.
47 *
48 * @var int
49 */
50 public $contact_id;
51
52 /**
53 * Class constructor.
54 */
55 public function __construct() {
56 $this->__table = 'civicrm_case_contact';
57 parent::__construct();
58 }
59
60 /**
61 * Returns foreign keys and entity references.
62 *
63 * @return array
64 * [CRM_Core_Reference_Interface]
65 */
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']);
72 }
73 return Civi::$statics[__CLASS__]['links'];
74 }
75
76 /**
77 * Returns all the column names of this table
78 *
79 * @return array
80 */
81 public static function &fields() {
82 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
83 Civi::$statics[__CLASS__]['fields'] = [
84 'id' => [
85 'name' => 'id',
86 'type' => CRM_Utils_Type::T_INT,
87 'title' => ts('Case Contact ID'),
88 'description' => ts('Unique case-contact association id'),
89 'required' => TRUE,
90 'where' => 'civicrm_case_contact.id',
91 'table_name' => 'civicrm_case_contact',
92 'entity' => 'CaseContact',
93 'bao' => 'CRM_Case_BAO_CaseContact',
94 'localizable' => 0,
95 ],
96 'case_id' => [
97 'name' => 'case_id',
98 'type' => CRM_Utils_Type::T_INT,
99 'title' => ts('Case'),
100 'description' => ts('Case ID of case-contact association.'),
101 'required' => TRUE,
102 'where' => 'civicrm_case_contact.case_id',
103 'table_name' => 'civicrm_case_contact',
104 'entity' => 'CaseContact',
105 'bao' => 'CRM_Case_BAO_CaseContact',
106 'localizable' => 0,
107 'FKClassName' => 'CRM_Case_DAO_Case',
108 ],
109 'contact_id' => [
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.'),
114 'required' => TRUE,
115 'where' => 'civicrm_case_contact.contact_id',
116 'table_name' => 'civicrm_case_contact',
117 'entity' => 'CaseContact',
118 'bao' => 'CRM_Case_BAO_CaseContact',
119 'localizable' => 0,
120 'FKClassName' => 'CRM_Contact_DAO_Contact',
121 'html' => [
122 'type' => 'EntityRef',
123 ],
124 ],
125 ];
126 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
127 }
128 return Civi::$statics[__CLASS__]['fields'];
129 }
130
131 /**
132 * Return a mapping from field-name to the corresponding key (as used in fields()).
133 *
134 * @return array
135 * Array(string $name => string $uniqueName).
136 */
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()));
140 }
141 return Civi::$statics[__CLASS__]['fieldKeys'];
142 }
143
144 /**
145 * Returns the names of this table
146 *
147 * @return string
148 */
149 public static function getTableName() {
150 return self::$_tableName;
151 }
152
153 /**
154 * Returns if this table needs to be logged
155 *
156 * @return bool
157 */
158 public function getLog() {
159 return self::$_log;
160 }
161
162 /**
163 * Returns the list of fields that can be imported
164 *
165 * @param bool $prefix
166 *
167 * @return array
168 */
169 public static function &import($prefix = FALSE) {
170 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'case_contact', $prefix, []);
171 return $r;
172 }
173
174 /**
175 * Returns the list of fields that can be exported
176 *
177 * @param bool $prefix
178 *
179 * @return array
180 */
181 public static function &export($prefix = FALSE) {
182 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'case_contact', $prefix, []);
183 return $r;
184 }
185
186 /**
187 * Returns the list of indices
188 *
189 * @param bool $localize
190 *
191 * @return array
192 */
193 public static function indices($localize = TRUE) {
194 $indices = [
195 'UI_case_contact_id' => [
196 'name' => 'UI_case_contact_id',
197 'field' => [
198 0 => 'case_id',
199 1 => 'contact_id',
200 ],
201 'localizable' => FALSE,
202 'unique' => TRUE,
203 'sig' => 'civicrm_case_contact::1::case_id::contact_id',
204 ],
205 ];
206 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
207 }
208
209 }