API/DAO Metadata - Retain versioning metadata for possible usage in runtime+tooling
[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:4a71399455a593008da4849db726f7b9)
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 localized title of this entity.
62 */
63 public static function getEntityTitle() {
64 return ts('Case Contacts');
65 }
66
67 /**
68 * Returns foreign keys and entity references.
69 *
70 * @return array
71 * [CRM_Core_Reference_Interface]
72 */
73 public static function getReferenceColumns() {
74 if (!isset(Civi::$statics[__CLASS__]['links'])) {
75 Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__);
76 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'case_id', 'civicrm_case', 'id');
77 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'contact_id', 'civicrm_contact', 'id');
78 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
79 }
80 return Civi::$statics[__CLASS__]['links'];
81 }
82
83 /**
84 * Returns all the column names of this table
85 *
86 * @return array
87 */
88 public static function &fields() {
89 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
90 Civi::$statics[__CLASS__]['fields'] = [
91 'id' => [
92 'name' => 'id',
93 'type' => CRM_Utils_Type::T_INT,
94 'title' => ts('Case Contact ID'),
95 'description' => ts('Unique case-contact association id'),
96 'required' => TRUE,
97 'where' => 'civicrm_case_contact.id',
98 'table_name' => 'civicrm_case_contact',
99 'entity' => 'CaseContact',
100 'bao' => 'CRM_Case_BAO_CaseContact',
101 'localizable' => 0,
102 'add' => '2.1',
103 ],
104 'case_id' => [
105 'name' => 'case_id',
106 'type' => CRM_Utils_Type::T_INT,
107 'title' => ts('Case'),
108 'description' => ts('Case ID of case-contact association.'),
109 'required' => TRUE,
110 'where' => 'civicrm_case_contact.case_id',
111 'table_name' => 'civicrm_case_contact',
112 'entity' => 'CaseContact',
113 'bao' => 'CRM_Case_BAO_CaseContact',
114 'localizable' => 0,
115 'FKClassName' => 'CRM_Case_DAO_Case',
116 'add' => '2.1',
117 ],
118 'contact_id' => [
119 'name' => 'contact_id',
120 'type' => CRM_Utils_Type::T_INT,
121 'title' => ts('Contact ID'),
122 'description' => ts('Contact ID of contact record given case belongs to.'),
123 'required' => TRUE,
124 'where' => 'civicrm_case_contact.contact_id',
125 'table_name' => 'civicrm_case_contact',
126 'entity' => 'CaseContact',
127 'bao' => 'CRM_Case_BAO_CaseContact',
128 'localizable' => 0,
129 'FKClassName' => 'CRM_Contact_DAO_Contact',
130 'html' => [
131 'type' => 'EntityRef',
132 ],
133 'add' => '2.1',
134 ],
135 ];
136 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
137 }
138 return Civi::$statics[__CLASS__]['fields'];
139 }
140
141 /**
142 * Return a mapping from field-name to the corresponding key (as used in fields()).
143 *
144 * @return array
145 * Array(string $name => string $uniqueName).
146 */
147 public static function &fieldKeys() {
148 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
149 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
150 }
151 return Civi::$statics[__CLASS__]['fieldKeys'];
152 }
153
154 /**
155 * Returns the names of this table
156 *
157 * @return string
158 */
159 public static function getTableName() {
160 return self::$_tableName;
161 }
162
163 /**
164 * Returns if this table needs to be logged
165 *
166 * @return bool
167 */
168 public function getLog() {
169 return self::$_log;
170 }
171
172 /**
173 * Returns the list of fields that can be imported
174 *
175 * @param bool $prefix
176 *
177 * @return array
178 */
179 public static function &import($prefix = FALSE) {
180 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'case_contact', $prefix, []);
181 return $r;
182 }
183
184 /**
185 * Returns the list of fields that can be exported
186 *
187 * @param bool $prefix
188 *
189 * @return array
190 */
191 public static function &export($prefix = FALSE) {
192 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'case_contact', $prefix, []);
193 return $r;
194 }
195
196 /**
197 * Returns the list of indices
198 *
199 * @param bool $localize
200 *
201 * @return array
202 */
203 public static function indices($localize = TRUE) {
204 $indices = [
205 'UI_case_contact_id' => [
206 'name' => 'UI_case_contact_id',
207 'field' => [
208 0 => 'case_id',
209 1 => 'contact_id',
210 ],
211 'localizable' => FALSE,
212 'unique' => TRUE,
213 'sig' => 'civicrm_case_contact::1::case_id::contact_id',
214 ],
215 ];
216 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
217 }
218
219 }