Commit | Line | Data |
---|---|---|
e501603b | 1 | <?php |
c3fc2621 | 2 | |
e501603b TO |
3 | /** |
4 | * @package CRM | |
6b83d5bd | 5 | * @copyright CiviCRM LLC (c) 2004-2019 |
e501603b TO |
6 | * |
7 | * Generated from xml/schema/CRM/Case/Case.xml | |
8 | * DO NOT EDIT. Generated by CRM_Core_CodeGen | |
74db51d3 | 9 | * (GenCodeChecksum:c5896e4b577b32d8a2c62d3cba65119d) |
e501603b | 10 | */ |
c3fc2621 | 11 | |
f41f0342 | 12 | /** |
c3fc2621 | 13 | * Database access object for the Case entity. |
f41f0342 | 14 | */ |
e501603b | 15 | class CRM_Case_DAO_Case extends CRM_Core_DAO { |
c3fc2621 | 16 | |
e501603b | 17 | /** |
f41f0342 | 18 | * Static instance to hold the table name. |
e501603b TO |
19 | * |
20 | * @var string | |
21 | */ | |
fa45b5b9 | 22 | public static $_tableName = 'civicrm_case'; |
c3fc2621 | 23 | |
e501603b | 24 | /** |
f41f0342 | 25 | * Should CiviCRM log any modifications to this table in the civicrm_log table. |
e501603b | 26 | * |
c3fc2621 | 27 | * @var bool |
e501603b | 28 | */ |
fa45b5b9 | 29 | public static $_log = TRUE; |
c3fc2621 | 30 | |
e501603b TO |
31 | /** |
32 | * Unique Case ID | |
33 | * | |
e6ca0a57 | 34 | * @var int |
e501603b TO |
35 | */ |
36 | public $id; | |
c3fc2621 | 37 | |
e501603b TO |
38 | /** |
39 | * FK to civicrm_case_type.id | |
40 | * | |
e6ca0a57 | 41 | * @var int |
e501603b TO |
42 | */ |
43 | public $case_type_id; | |
c3fc2621 | 44 | |
e501603b TO |
45 | /** |
46 | * Short name of the case. | |
47 | * | |
48 | * @var string | |
49 | */ | |
50 | public $subject; | |
c3fc2621 | 51 | |
e501603b TO |
52 | /** |
53 | * Date on which given case starts. | |
54 | * | |
55 | * @var date | |
56 | */ | |
57 | public $start_date; | |
c3fc2621 | 58 | |
e501603b TO |
59 | /** |
60 | * Date on which given case ends. | |
61 | * | |
62 | * @var date | |
63 | */ | |
64 | public $end_date; | |
c3fc2621 | 65 | |
e501603b TO |
66 | /** |
67 | * Details about the meeting (agenda, notes, etc). | |
68 | * | |
69 | * @var text | |
70 | */ | |
71 | public $details; | |
c3fc2621 | 72 | |
e501603b TO |
73 | /** |
74 | * Id of case status. | |
75 | * | |
e6ca0a57 | 76 | * @var int |
e501603b TO |
77 | */ |
78 | public $status_id; | |
c3fc2621 | 79 | |
e501603b | 80 | /** |
e6ca0a57 | 81 | * @var bool |
e501603b TO |
82 | */ |
83 | public $is_deleted; | |
c3fc2621 | 84 | |
3ed77291 TO |
85 | /** |
86 | * When was the case was created. | |
87 | * | |
88 | * @var timestamp | |
89 | */ | |
90 | public $created_date; | |
c3fc2621 | 91 | |
3ed77291 TO |
92 | /** |
93 | * When was the case (or closely related entity) was created or modified or deleted. | |
94 | * | |
95 | * @var timestamp | |
96 | */ | |
97 | public $modified_date; | |
c3fc2621 | 98 | |
e501603b | 99 | /** |
f41f0342 | 100 | * Class constructor. |
e501603b | 101 | */ |
c3fc2621 | 102 | public function __construct() { |
e501603b TO |
103 | $this->__table = 'civicrm_case'; |
104 | parent::__construct(); | |
105 | } | |
c3fc2621 | 106 | |
e501603b | 107 | /** |
f41f0342 | 108 | * Returns foreign keys and entity references. |
e501603b TO |
109 | * |
110 | * @return array | |
111 | * [CRM_Core_Reference_Interface] | |
112 | */ | |
c3fc2621 | 113 | public static function getReferenceColumns() { |
346aaaba | 114 | if (!isset(Civi::$statics[__CLASS__]['links'])) { |
fa45b5b9 | 115 | Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__); |
c3fc2621 | 116 | Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'case_type_id', 'civicrm_case_type', 'id'); |
346aaaba | 117 | CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']); |
e501603b | 118 | } |
346aaaba | 119 | return Civi::$statics[__CLASS__]['links']; |
e501603b | 120 | } |
c3fc2621 | 121 | |
e501603b TO |
122 | /** |
123 | * Returns all the column names of this table | |
124 | * | |
125 | * @return array | |
126 | */ | |
c3fc2621 | 127 | public static function &fields() { |
346aaaba | 128 | if (!isset(Civi::$statics[__CLASS__]['fields'])) { |
c3fc2621 CW |
129 | Civi::$statics[__CLASS__]['fields'] = [ |
130 | 'case_id' => [ | |
e501603b TO |
131 | 'name' => 'id', |
132 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 133 | 'title' => ts('Case ID'), |
215b423e | 134 | 'description' => ts('Unique Case ID'), |
c3fc2621 CW |
135 | 'required' => TRUE, |
136 | 'import' => TRUE, | |
e501603b | 137 | 'where' => 'civicrm_case.id', |
c3fc2621 | 138 | 'export' => TRUE, |
522a26c9 | 139 | 'table_name' => 'civicrm_case', |
140 | 'entity' => 'Case', | |
141 | 'bao' => 'CRM_Case_BAO_Case', | |
6a7e5e5d | 142 | 'localizable' => 0, |
c3fc2621 CW |
143 | ], |
144 | 'case_type_id' => [ | |
e501603b TO |
145 | 'name' => 'case_type_id', |
146 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 147 | 'title' => ts('Case Type'), |
215b423e | 148 | 'description' => ts('FK to civicrm_case_type.id'), |
c3fc2621 CW |
149 | 'required' => TRUE, |
150 | 'import' => TRUE, | |
e501603b | 151 | 'where' => 'civicrm_case.case_type_id', |
c3fc2621 | 152 | 'export' => FALSE, |
522a26c9 | 153 | 'table_name' => 'civicrm_case', |
154 | 'entity' => 'Case', | |
155 | 'bao' => 'CRM_Case_BAO_Case', | |
6a7e5e5d | 156 | 'localizable' => 0, |
e501603b | 157 | 'FKClassName' => 'CRM_Case_DAO_CaseType', |
c3fc2621 | 158 | 'html' => [ |
e501603b | 159 | 'type' => 'Select', |
c3fc2621 CW |
160 | ], |
161 | 'pseudoconstant' => [ | |
e501603b TO |
162 | 'table' => 'civicrm_case_type', |
163 | 'keyColumn' => 'id', | |
164 | 'labelColumn' => 'title', | |
e6ca0a57 | 165 | ], |
c3fc2621 CW |
166 | ], |
167 | 'case_subject' => [ | |
e501603b TO |
168 | 'name' => 'subject', |
169 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 170 | 'title' => ts('Case Subject'), |
215b423e | 171 | 'description' => ts('Short name of the case.'), |
e501603b TO |
172 | 'maxlength' => 128, |
173 | 'size' => CRM_Utils_Type::HUGE, | |
c3fc2621 | 174 | 'import' => TRUE, |
e501603b | 175 | 'where' => 'civicrm_case.subject', |
c3fc2621 | 176 | 'export' => TRUE, |
522a26c9 | 177 | 'table_name' => 'civicrm_case', |
178 | 'entity' => 'Case', | |
179 | 'bao' => 'CRM_Case_BAO_Case', | |
6a7e5e5d | 180 | 'localizable' => 0, |
c3fc2621 | 181 | 'html' => [ |
e501603b | 182 | 'type' => 'Text', |
c3fc2621 CW |
183 | ], |
184 | ], | |
185 | 'case_start_date' => [ | |
e501603b TO |
186 | 'name' => 'start_date', |
187 | 'type' => CRM_Utils_Type::T_DATE, | |
c3fc2621 | 188 | 'title' => ts('Case Start Date'), |
215b423e | 189 | 'description' => ts('Date on which given case starts.'), |
c3fc2621 | 190 | 'import' => TRUE, |
e501603b | 191 | 'where' => 'civicrm_case.start_date', |
c3fc2621 | 192 | 'export' => TRUE, |
522a26c9 | 193 | 'table_name' => 'civicrm_case', |
194 | 'entity' => 'Case', | |
195 | 'bao' => 'CRM_Case_BAO_Case', | |
6a7e5e5d | 196 | 'localizable' => 0, |
c3fc2621 | 197 | 'html' => [ |
e501603b | 198 | 'type' => 'Select Date', |
e0d4ddde | 199 | 'formatType' => 'activityDateTime', |
c3fc2621 CW |
200 | ], |
201 | ], | |
202 | 'case_end_date' => [ | |
e501603b TO |
203 | 'name' => 'end_date', |
204 | 'type' => CRM_Utils_Type::T_DATE, | |
c3fc2621 | 205 | 'title' => ts('Case End Date'), |
215b423e | 206 | 'description' => ts('Date on which given case ends.'), |
c3fc2621 | 207 | 'import' => TRUE, |
e501603b | 208 | 'where' => 'civicrm_case.end_date', |
c3fc2621 | 209 | 'export' => TRUE, |
522a26c9 | 210 | 'table_name' => 'civicrm_case', |
211 | 'entity' => 'Case', | |
212 | 'bao' => 'CRM_Case_BAO_Case', | |
6a7e5e5d | 213 | 'localizable' => 0, |
c3fc2621 | 214 | 'html' => [ |
e501603b | 215 | 'type' => 'Select Date', |
e0d4ddde | 216 | 'formatType' => 'activityDateTime', |
c3fc2621 CW |
217 | ], |
218 | ], | |
219 | 'details' => [ | |
e501603b TO |
220 | 'name' => 'details', |
221 | 'type' => CRM_Utils_Type::T_TEXT, | |
c3fc2621 | 222 | 'title' => ts('Details'), |
215b423e | 223 | 'description' => ts('Details about the meeting (agenda, notes, etc).'), |
e501603b TO |
224 | 'rows' => 8, |
225 | 'cols' => 60, | |
a36434b9 | 226 | 'where' => 'civicrm_case.details', |
522a26c9 | 227 | 'table_name' => 'civicrm_case', |
228 | 'entity' => 'Case', | |
229 | 'bao' => 'CRM_Case_BAO_Case', | |
6a7e5e5d | 230 | 'localizable' => 0, |
c3fc2621 | 231 | 'html' => [ |
e501603b | 232 | 'type' => 'TextArea', |
c3fc2621 CW |
233 | ], |
234 | ], | |
235 | 'case_status_id' => [ | |
e501603b TO |
236 | 'name' => 'status_id', |
237 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 238 | 'title' => ts('Case Status'), |
215b423e | 239 | 'description' => ts('Id of case status.'), |
c3fc2621 CW |
240 | 'required' => TRUE, |
241 | 'import' => TRUE, | |
e501603b | 242 | 'where' => 'civicrm_case.status_id', |
c3fc2621 | 243 | 'export' => FALSE, |
522a26c9 | 244 | 'table_name' => 'civicrm_case', |
245 | 'entity' => 'Case', | |
246 | 'bao' => 'CRM_Case_BAO_Case', | |
6a7e5e5d | 247 | 'localizable' => 0, |
c3fc2621 | 248 | 'html' => [ |
e501603b | 249 | 'type' => 'Select', |
c3fc2621 CW |
250 | ], |
251 | 'pseudoconstant' => [ | |
e501603b TO |
252 | 'optionGroupName' => 'case_status', |
253 | 'optionEditPath' => 'civicrm/admin/options/case_status', | |
e6ca0a57 | 254 | ], |
c3fc2621 CW |
255 | ], |
256 | 'case_deleted' => [ | |
e501603b TO |
257 | 'name' => 'is_deleted', |
258 | 'type' => CRM_Utils_Type::T_BOOLEAN, | |
c3fc2621 CW |
259 | 'title' => ts('Case is in the Trash'), |
260 | 'import' => TRUE, | |
e501603b | 261 | 'where' => 'civicrm_case.is_deleted', |
c3fc2621 | 262 | 'export' => TRUE, |
45a83e42 | 263 | 'default' => '0', |
522a26c9 | 264 | 'table_name' => 'civicrm_case', |
265 | 'entity' => 'Case', | |
266 | 'bao' => 'CRM_Case_BAO_Case', | |
6a7e5e5d | 267 | 'localizable' => 0, |
c3fc2621 CW |
268 | ], |
269 | 'case_created_date' => [ | |
3ed77291 TO |
270 | 'name' => 'created_date', |
271 | 'type' => CRM_Utils_Type::T_TIMESTAMP, | |
c3fc2621 | 272 | 'title' => ts('Created Date'), |
215b423e | 273 | 'description' => ts('When was the case was created.'), |
c3fc2621 | 274 | 'required' => FALSE, |
3ed77291 | 275 | 'where' => 'civicrm_case.created_date', |
a36434b9 | 276 | 'export' => TRUE, |
3ed77291 TO |
277 | 'default' => 'NULL', |
278 | 'table_name' => 'civicrm_case', | |
279 | 'entity' => 'Case', | |
280 | 'bao' => 'CRM_Case_BAO_Case', | |
281 | 'localizable' => 0, | |
c3fc2621 CW |
282 | ], |
283 | 'case_modified_date' => [ | |
3ed77291 TO |
284 | 'name' => 'modified_date', |
285 | 'type' => CRM_Utils_Type::T_TIMESTAMP, | |
c3fc2621 | 286 | 'title' => ts('Modified Date'), |
215b423e | 287 | 'description' => ts('When was the case (or closely related entity) was created or modified or deleted.'), |
c3fc2621 | 288 | 'required' => FALSE, |
3ed77291 | 289 | 'where' => 'civicrm_case.modified_date', |
a36434b9 | 290 | 'export' => TRUE, |
3ed77291 TO |
291 | 'default' => 'CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP', |
292 | 'table_name' => 'civicrm_case', | |
293 | 'entity' => 'Case', | |
294 | 'bao' => 'CRM_Case_BAO_Case', | |
295 | 'localizable' => 0, | |
c3fc2621 CW |
296 | ], |
297 | ]; | |
346aaaba | 298 | CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); |
e501603b | 299 | } |
346aaaba | 300 | return Civi::$statics[__CLASS__]['fields']; |
e501603b | 301 | } |
c3fc2621 | 302 | |
e501603b | 303 | /** |
bd8e0b14 | 304 | * Return a mapping from field-name to the corresponding key (as used in fields()). |
e501603b TO |
305 | * |
306 | * @return array | |
bd8e0b14 | 307 | * Array(string $name => string $uniqueName). |
e501603b | 308 | */ |
c3fc2621 | 309 | public static function &fieldKeys() { |
bd8e0b14 TO |
310 | if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { |
311 | Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); | |
e501603b | 312 | } |
bd8e0b14 | 313 | return Civi::$statics[__CLASS__]['fieldKeys']; |
e501603b | 314 | } |
c3fc2621 | 315 | |
e501603b TO |
316 | /** |
317 | * Returns the names of this table | |
318 | * | |
319 | * @return string | |
320 | */ | |
c3fc2621 | 321 | public static function getTableName() { |
e501603b TO |
322 | return self::$_tableName; |
323 | } | |
c3fc2621 | 324 | |
e501603b TO |
325 | /** |
326 | * Returns if this table needs to be logged | |
327 | * | |
c3fc2621 | 328 | * @return bool |
e501603b | 329 | */ |
c3fc2621 | 330 | public function getLog() { |
e501603b TO |
331 | return self::$_log; |
332 | } | |
c3fc2621 | 333 | |
e501603b TO |
334 | /** |
335 | * Returns the list of fields that can be imported | |
336 | * | |
337 | * @param bool $prefix | |
338 | * | |
339 | * @return array | |
340 | */ | |
c3fc2621 CW |
341 | public static function &import($prefix = FALSE) { |
342 | $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'case', $prefix, []); | |
60808919 | 343 | return $r; |
e501603b | 344 | } |
c3fc2621 | 345 | |
e501603b TO |
346 | /** |
347 | * Returns the list of fields that can be exported | |
348 | * | |
349 | * @param bool $prefix | |
350 | * | |
351 | * @return array | |
352 | */ | |
c3fc2621 CW |
353 | public static function &export($prefix = FALSE) { |
354 | $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'case', $prefix, []); | |
60808919 | 355 | return $r; |
e501603b | 356 | } |
c3fc2621 | 357 | |
e7a6b91a AS |
358 | /** |
359 | * Returns the list of indices | |
c3fc2621 CW |
360 | * |
361 | * @param bool $localize | |
362 | * | |
363 | * @return array | |
e7a6b91a AS |
364 | */ |
365 | public static function indices($localize = TRUE) { | |
c3fc2621 CW |
366 | $indices = [ |
367 | 'index_case_type_id' => [ | |
e7a6b91a | 368 | 'name' => 'index_case_type_id', |
c3fc2621 | 369 | 'field' => [ |
e7a6b91a | 370 | 0 => 'case_type_id', |
c3fc2621 CW |
371 | ], |
372 | 'localizable' => FALSE, | |
e7a6b91a | 373 | 'sig' => 'civicrm_case::0::case_type_id', |
c3fc2621 CW |
374 | ], |
375 | 'index_is_deleted' => [ | |
e7a6b91a | 376 | 'name' => 'index_is_deleted', |
c3fc2621 | 377 | 'field' => [ |
e7a6b91a | 378 | 0 => 'is_deleted', |
c3fc2621 CW |
379 | ], |
380 | 'localizable' => FALSE, | |
e7a6b91a | 381 | 'sig' => 'civicrm_case::0::is_deleted', |
c3fc2621 CW |
382 | ], |
383 | ]; | |
e7a6b91a AS |
384 | return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; |
385 | } | |
c3fc2621 | 386 | |
e501603b | 387 | } |