Declare API Key as a protected field for future use
[civicrm-core.git] / CRM / Case / DAO / Case.php
1 <?php
2
3 /**
4 * @package CRM
5 * @copyright CiviCRM LLC (c) 2004-2019
6 *
7 * Generated from xml/schema/CRM/Case/Case.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:78deb4145e1eee5605441facd38817fb)
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 public 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 public 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' => ts('Unique Case ID'),
135 'required' => TRUE,
136 'import' => TRUE,
137 'where' => 'civicrm_case.id',
138 'export' => TRUE,
139 'table_name' => 'civicrm_case',
140 'entity' => 'Case',
141 'bao' => 'CRM_Case_BAO_Case',
142 'localizable' => 0,
143 ],
144 'case_type_id' => [
145 'name' => 'case_type_id',
146 'type' => CRM_Utils_Type::T_INT,
147 'title' => ts('Case Type'),
148 'description' => ts('FK to civicrm_case_type.id'),
149 'required' => TRUE,
150 'import' => TRUE,
151 'where' => 'civicrm_case.case_type_id',
152 'export' => FALSE,
153 'table_name' => 'civicrm_case',
154 'entity' => 'Case',
155 'bao' => 'CRM_Case_BAO_Case',
156 'localizable' => 0,
157 'FKClassName' => 'CRM_Case_DAO_CaseType',
158 'html' => [
159 'type' => 'Select',
160 ],
161 'pseudoconstant' => [
162 'table' => 'civicrm_case_type',
163 'keyColumn' => 'id',
164 'labelColumn' => 'title',
165 ]
166 ],
167 'case_subject' => [
168 'name' => 'subject',
169 'type' => CRM_Utils_Type::T_STRING,
170 'title' => ts('Case Subject'),
171 'description' => ts('Short name of the case.'),
172 'maxlength' => 128,
173 'size' => CRM_Utils_Type::HUGE,
174 'import' => TRUE,
175 'where' => 'civicrm_case.subject',
176 'export' => TRUE,
177 'table_name' => 'civicrm_case',
178 'entity' => 'Case',
179 'bao' => 'CRM_Case_BAO_Case',
180 'localizable' => 0,
181 'html' => [
182 'type' => 'Text',
183 ],
184 ],
185 'case_start_date' => [
186 'name' => 'start_date',
187 'type' => CRM_Utils_Type::T_DATE,
188 'title' => ts('Case Start Date'),
189 'description' => ts('Date on which given case starts.'),
190 'import' => TRUE,
191 'where' => 'civicrm_case.start_date',
192 'export' => TRUE,
193 'table_name' => 'civicrm_case',
194 'entity' => 'Case',
195 'bao' => 'CRM_Case_BAO_Case',
196 'localizable' => 0,
197 'html' => [
198 'type' => 'Select Date',
199 'formatType' => 'activityDateTime',
200 ],
201 ],
202 'case_end_date' => [
203 'name' => 'end_date',
204 'type' => CRM_Utils_Type::T_DATE,
205 'title' => ts('Case End Date'),
206 'description' => ts('Date on which given case ends.'),
207 'import' => TRUE,
208 'where' => 'civicrm_case.end_date',
209 'export' => TRUE,
210 'table_name' => 'civicrm_case',
211 'entity' => 'Case',
212 'bao' => 'CRM_Case_BAO_Case',
213 'localizable' => 0,
214 'html' => [
215 'type' => 'Select Date',
216 'formatType' => 'activityDateTime',
217 ],
218 ],
219 'details' => [
220 'name' => 'details',
221 'type' => CRM_Utils_Type::T_TEXT,
222 'title' => ts('Details'),
223 'description' => ts('Details about the meeting (agenda, notes, etc).'),
224 'rows' => 8,
225 'cols' => 60,
226 'where' => 'civicrm_case.details',
227 'table_name' => 'civicrm_case',
228 'entity' => 'Case',
229 'bao' => 'CRM_Case_BAO_Case',
230 'localizable' => 0,
231 'html' => [
232 'type' => 'TextArea',
233 ],
234 ],
235 'case_status_id' => [
236 'name' => 'status_id',
237 'type' => CRM_Utils_Type::T_INT,
238 'title' => ts('Case Status'),
239 'description' => ts('Id of case status.'),
240 'required' => TRUE,
241 'import' => TRUE,
242 'where' => 'civicrm_case.status_id',
243 'export' => FALSE,
244 'table_name' => 'civicrm_case',
245 'entity' => 'Case',
246 'bao' => 'CRM_Case_BAO_Case',
247 'localizable' => 0,
248 'html' => [
249 'type' => 'Select',
250 ],
251 'pseudoconstant' => [
252 'optionGroupName' => 'case_status',
253 'optionEditPath' => 'civicrm/admin/options/case_status',
254 ]
255 ],
256 'case_deleted' => [
257 'name' => 'is_deleted',
258 'type' => CRM_Utils_Type::T_BOOLEAN,
259 'title' => ts('Case is in the Trash'),
260 'import' => TRUE,
261 'where' => 'civicrm_case.is_deleted',
262 'export' => TRUE,
263 'default' => '0',
264 'table_name' => 'civicrm_case',
265 'entity' => 'Case',
266 'bao' => 'CRM_Case_BAO_Case',
267 'localizable' => 0,
268 ],
269 'case_created_date' => [
270 'name' => 'created_date',
271 'type' => CRM_Utils_Type::T_TIMESTAMP,
272 'title' => ts('Created Date'),
273 'description' => ts('When was the case was created.'),
274 'required' => FALSE,
275 'where' => 'civicrm_case.created_date',
276 'export' => TRUE,
277 'default' => 'NULL',
278 'table_name' => 'civicrm_case',
279 'entity' => 'Case',
280 'bao' => 'CRM_Case_BAO_Case',
281 'localizable' => 0,
282 ],
283 'case_modified_date' => [
284 'name' => 'modified_date',
285 'type' => CRM_Utils_Type::T_TIMESTAMP,
286 'title' => ts('Modified Date'),
287 'description' => ts('When was the case (or closely related entity) was created or modified or deleted.'),
288 'required' => FALSE,
289 'where' => 'civicrm_case.modified_date',
290 'export' => TRUE,
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,
296 ],
297 ];
298 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
299 }
300 return Civi::$statics[__CLASS__]['fields'];
301 }
302
303 /**
304 * Return a mapping from field-name to the corresponding key (as used in fields()).
305 *
306 * @return array
307 * Array(string $name => string $uniqueName).
308 */
309 public static function &fieldKeys() {
310 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
311 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
312 }
313 return Civi::$statics[__CLASS__]['fieldKeys'];
314 }
315
316 /**
317 * Returns the names of this table
318 *
319 * @return string
320 */
321 public static function getTableName() {
322 return self::$_tableName;
323 }
324
325 /**
326 * Returns if this table needs to be logged
327 *
328 * @return bool
329 */
330 public function getLog() {
331 return self::$_log;
332 }
333
334 /**
335 * Returns the list of fields that can be imported
336 *
337 * @param bool $prefix
338 *
339 * @return array
340 */
341 public static function &import($prefix = FALSE) {
342 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'case', $prefix, []);
343 return $r;
344 }
345
346 /**
347 * Returns the list of fields that can be exported
348 *
349 * @param bool $prefix
350 *
351 * @return array
352 */
353 public static function &export($prefix = FALSE) {
354 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'case', $prefix, []);
355 return $r;
356 }
357
358 /**
359 * Returns the list of indices
360 *
361 * @param bool $localize
362 *
363 * @return array
364 */
365 public static function indices($localize = TRUE) {
366 $indices = [
367 'index_case_type_id' => [
368 'name' => 'index_case_type_id',
369 'field' => [
370 0 => 'case_type_id',
371 ],
372 'localizable' => FALSE,
373 'sig' => 'civicrm_case::0::case_type_id',
374 ],
375 'index_is_deleted' => [
376 'name' => 'index_is_deleted',
377 'field' => [
378 0 => 'is_deleted',
379 ],
380 'localizable' => FALSE,
381 'sig' => 'civicrm_case::0::is_deleted',
382 ],
383 ];
384 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
385 }
386
387 }