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