Regenerate DAOs with readonly attribute for id fields
[civicrm-core.git] / CRM / Batch / DAO / Batch.php
1 <?php
2
3 /**
4 * @package CRM
5 * @copyright CiviCRM LLC https://civicrm.org/licensing
6 *
7 * Generated from xml/schema/CRM/Batch/Batch.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:21bc670b9083e60a58ccd4713958c192)
10 */
11
12 /**
13 * Database access object for the Batch entity.
14 */
15 class CRM_Batch_DAO_Batch extends CRM_Core_DAO {
16 const EXT = 'civicrm';
17 const TABLE_ADDED = '3.3';
18
19 /**
20 * Static instance to hold the table name.
21 *
22 * @var string
23 */
24 public static $_tableName = 'civicrm_batch';
25
26 /**
27 * Should CiviCRM log any modifications to this table in the civicrm_log table.
28 *
29 * @var bool
30 */
31 public static $_log = FALSE;
32
33 /**
34 * Unique Address ID
35 *
36 * @var int
37 */
38 public $id;
39
40 /**
41 * Variable name/programmatic handle for this batch.
42 *
43 * @var string
44 */
45 public $name;
46
47 /**
48 * Friendly Name.
49 *
50 * @var string
51 */
52 public $title;
53
54 /**
55 * Description of this batch set.
56 *
57 * @var text
58 */
59 public $description;
60
61 /**
62 * FK to Contact ID
63 *
64 * @var int
65 */
66 public $created_id;
67
68 /**
69 * When was this item created
70 *
71 * @var datetime
72 */
73 public $created_date;
74
75 /**
76 * FK to Contact ID
77 *
78 * @var int
79 */
80 public $modified_id;
81
82 /**
83 * When was this item created
84 *
85 * @var datetime
86 */
87 public $modified_date;
88
89 /**
90 * FK to Saved Search ID
91 *
92 * @var int
93 */
94 public $saved_search_id;
95
96 /**
97 * fk to Batch Status options in civicrm_option_values
98 *
99 * @var int
100 */
101 public $status_id;
102
103 /**
104 * fk to Batch Type options in civicrm_option_values
105 *
106 * @var int
107 */
108 public $type_id;
109
110 /**
111 * fk to Batch mode options in civicrm_option_values
112 *
113 * @var int
114 */
115 public $mode_id;
116
117 /**
118 * Total amount for this batch.
119 *
120 * @var float
121 */
122 public $total;
123
124 /**
125 * Number of items in a batch.
126 *
127 * @var int
128 */
129 public $item_count;
130
131 /**
132 * fk to Payment Instrument options in civicrm_option_values
133 *
134 * @var int
135 */
136 public $payment_instrument_id;
137
138 /**
139 * @var datetime
140 */
141 public $exported_date;
142
143 /**
144 * cache entered data
145 *
146 * @var longtext
147 */
148 public $data;
149
150 /**
151 * Class constructor.
152 */
153 public function __construct() {
154 $this->__table = 'civicrm_batch';
155 parent::__construct();
156 }
157
158 /**
159 * Returns localized title of this entity.
160 *
161 * @param bool $plural
162 * Whether to return the plural version of the title.
163 */
164 public static function getEntityTitle($plural = FALSE) {
165 return $plural ? ts('Batches') : ts('Batch');
166 }
167
168 /**
169 * Returns foreign keys and entity references.
170 *
171 * @return array
172 * [CRM_Core_Reference_Interface]
173 */
174 public static function getReferenceColumns() {
175 if (!isset(Civi::$statics[__CLASS__]['links'])) {
176 Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__);
177 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'created_id', 'civicrm_contact', 'id');
178 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'modified_id', 'civicrm_contact', 'id');
179 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'saved_search_id', 'civicrm_saved_search', 'id');
180 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
181 }
182 return Civi::$statics[__CLASS__]['links'];
183 }
184
185 /**
186 * Returns all the column names of this table
187 *
188 * @return array
189 */
190 public static function &fields() {
191 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
192 Civi::$statics[__CLASS__]['fields'] = [
193 'id' => [
194 'name' => 'id',
195 'type' => CRM_Utils_Type::T_INT,
196 'title' => ts('Batch ID'),
197 'description' => ts('Unique Address ID'),
198 'required' => TRUE,
199 'where' => 'civicrm_batch.id',
200 'table_name' => 'civicrm_batch',
201 'entity' => 'Batch',
202 'bao' => 'CRM_Batch_BAO_Batch',
203 'localizable' => 0,
204 'html' => [
205 'type' => 'Number',
206 ],
207 'readonly' => TRUE,
208 'add' => '3.3',
209 ],
210 'name' => [
211 'name' => 'name',
212 'type' => CRM_Utils_Type::T_STRING,
213 'title' => ts('Batch Name'),
214 'description' => ts('Variable name/programmatic handle for this batch.'),
215 'maxlength' => 64,
216 'size' => CRM_Utils_Type::BIG,
217 'where' => 'civicrm_batch.name',
218 'table_name' => 'civicrm_batch',
219 'entity' => 'Batch',
220 'bao' => 'CRM_Batch_BAO_Batch',
221 'localizable' => 0,
222 'html' => [
223 'type' => 'Text',
224 ],
225 'add' => '3.3',
226 ],
227 'title' => [
228 'name' => 'title',
229 'type' => CRM_Utils_Type::T_STRING,
230 'title' => ts('Batch Title'),
231 'description' => ts('Friendly Name.'),
232 'maxlength' => 255,
233 'size' => CRM_Utils_Type::HUGE,
234 'where' => 'civicrm_batch.title',
235 'table_name' => 'civicrm_batch',
236 'entity' => 'Batch',
237 'bao' => 'CRM_Batch_BAO_Batch',
238 'localizable' => 1,
239 'html' => [
240 'type' => 'Text',
241 ],
242 'add' => '4.2',
243 ],
244 'description' => [
245 'name' => 'description',
246 'type' => CRM_Utils_Type::T_TEXT,
247 'title' => ts('Batch Description'),
248 'description' => ts('Description of this batch set.'),
249 'rows' => 4,
250 'cols' => 80,
251 'where' => 'civicrm_batch.description',
252 'table_name' => 'civicrm_batch',
253 'entity' => 'Batch',
254 'bao' => 'CRM_Batch_BAO_Batch',
255 'localizable' => 1,
256 'html' => [
257 'type' => 'TextArea',
258 ],
259 'add' => '3.3',
260 ],
261 'created_id' => [
262 'name' => 'created_id',
263 'type' => CRM_Utils_Type::T_INT,
264 'title' => ts('Created By Contact ID'),
265 'description' => ts('FK to Contact ID'),
266 'where' => 'civicrm_batch.created_id',
267 'table_name' => 'civicrm_batch',
268 'entity' => 'Batch',
269 'bao' => 'CRM_Batch_BAO_Batch',
270 'localizable' => 0,
271 'FKClassName' => 'CRM_Contact_DAO_Contact',
272 'html' => [
273 'label' => ts("Created By"),
274 ],
275 'add' => '3.3',
276 ],
277 'created_date' => [
278 'name' => 'created_date',
279 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME,
280 'title' => ts('Batch Created Date'),
281 'description' => ts('When was this item created'),
282 'where' => 'civicrm_batch.created_date',
283 'table_name' => 'civicrm_batch',
284 'entity' => 'Batch',
285 'bao' => 'CRM_Batch_BAO_Batch',
286 'localizable' => 0,
287 'html' => [
288 'type' => 'Select Date',
289 'formatType' => 'activityDateTime',
290 ],
291 'add' => '3.3',
292 ],
293 'modified_id' => [
294 'name' => 'modified_id',
295 'type' => CRM_Utils_Type::T_INT,
296 'title' => ts('Modified By Contact ID'),
297 'description' => ts('FK to Contact ID'),
298 'where' => 'civicrm_batch.modified_id',
299 'table_name' => 'civicrm_batch',
300 'entity' => 'Batch',
301 'bao' => 'CRM_Batch_BAO_Batch',
302 'localizable' => 0,
303 'FKClassName' => 'CRM_Contact_DAO_Contact',
304 'html' => [
305 'label' => ts("Modified By"),
306 ],
307 'add' => '3.3',
308 ],
309 'modified_date' => [
310 'name' => 'modified_date',
311 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME,
312 'title' => ts('Batch Modified Date'),
313 'description' => ts('When was this item created'),
314 'where' => 'civicrm_batch.modified_date',
315 'table_name' => 'civicrm_batch',
316 'entity' => 'Batch',
317 'bao' => 'CRM_Batch_BAO_Batch',
318 'localizable' => 0,
319 'add' => '3.3',
320 ],
321 'saved_search_id' => [
322 'name' => 'saved_search_id',
323 'type' => CRM_Utils_Type::T_INT,
324 'title' => ts('Smart Group ID'),
325 'description' => ts('FK to Saved Search ID'),
326 'where' => 'civicrm_batch.saved_search_id',
327 'table_name' => 'civicrm_batch',
328 'entity' => 'Batch',
329 'bao' => 'CRM_Batch_BAO_Batch',
330 'localizable' => 0,
331 'FKClassName' => 'CRM_Contact_DAO_SavedSearch',
332 'html' => [
333 'type' => 'EntityRef',
334 'label' => ts("Smart Group"),
335 ],
336 'add' => '4.1',
337 ],
338 'status_id' => [
339 'name' => 'status_id',
340 'type' => CRM_Utils_Type::T_INT,
341 'title' => ts('Batch Status'),
342 'description' => ts('fk to Batch Status options in civicrm_option_values'),
343 'required' => TRUE,
344 'where' => 'civicrm_batch.status_id',
345 'table_name' => 'civicrm_batch',
346 'entity' => 'Batch',
347 'bao' => 'CRM_Batch_BAO_Batch',
348 'localizable' => 0,
349 'html' => [
350 'type' => 'Select',
351 ],
352 'pseudoconstant' => [
353 'optionGroupName' => 'batch_status',
354 'optionEditPath' => 'civicrm/admin/options/batch_status',
355 ],
356 'add' => '4.2',
357 ],
358 'type_id' => [
359 'name' => 'type_id',
360 'type' => CRM_Utils_Type::T_INT,
361 'title' => ts('Batch Type'),
362 'description' => ts('fk to Batch Type options in civicrm_option_values'),
363 'where' => 'civicrm_batch.type_id',
364 'table_name' => 'civicrm_batch',
365 'entity' => 'Batch',
366 'bao' => 'CRM_Batch_BAO_Batch',
367 'localizable' => 0,
368 'html' => [
369 'type' => 'Select',
370 ],
371 'pseudoconstant' => [
372 'optionGroupName' => 'batch_type',
373 'optionEditPath' => 'civicrm/admin/options/batch_type',
374 ],
375 'add' => '4.2',
376 ],
377 'mode_id' => [
378 'name' => 'mode_id',
379 'type' => CRM_Utils_Type::T_INT,
380 'title' => ts('Batch Mode'),
381 'description' => ts('fk to Batch mode options in civicrm_option_values'),
382 'where' => 'civicrm_batch.mode_id',
383 'table_name' => 'civicrm_batch',
384 'entity' => 'Batch',
385 'bao' => 'CRM_Batch_BAO_Batch',
386 'localizable' => 0,
387 'html' => [
388 'type' => 'Select',
389 ],
390 'pseudoconstant' => [
391 'optionGroupName' => 'batch_mode',
392 'optionEditPath' => 'civicrm/admin/options/batch_mode',
393 ],
394 'add' => '4.2',
395 ],
396 'total' => [
397 'name' => 'total',
398 'type' => CRM_Utils_Type::T_MONEY,
399 'title' => ts('Batch Total'),
400 'description' => ts('Total amount for this batch.'),
401 'precision' => [
402 20,
403 2,
404 ],
405 'where' => 'civicrm_batch.total',
406 'table_name' => 'civicrm_batch',
407 'entity' => 'Batch',
408 'bao' => 'CRM_Batch_BAO_Batch',
409 'localizable' => 0,
410 'html' => [
411 'type' => 'Text',
412 ],
413 'add' => '4.2',
414 ],
415 'item_count' => [
416 'name' => 'item_count',
417 'type' => CRM_Utils_Type::T_INT,
418 'title' => ts('Batch Number of Items'),
419 'description' => ts('Number of items in a batch.'),
420 'where' => 'civicrm_batch.item_count',
421 'table_name' => 'civicrm_batch',
422 'entity' => 'Batch',
423 'bao' => 'CRM_Batch_BAO_Batch',
424 'localizable' => 0,
425 'html' => [
426 'type' => 'Text',
427 ],
428 'add' => '4.2',
429 ],
430 'payment_instrument_id' => [
431 'name' => 'payment_instrument_id',
432 'type' => CRM_Utils_Type::T_INT,
433 'title' => ts('Batch Payment Method'),
434 'description' => ts('fk to Payment Instrument options in civicrm_option_values'),
435 'where' => 'civicrm_batch.payment_instrument_id',
436 'table_name' => 'civicrm_batch',
437 'entity' => 'Batch',
438 'bao' => 'CRM_Batch_BAO_Batch',
439 'localizable' => 0,
440 'html' => [
441 'type' => 'Select',
442 ],
443 'pseudoconstant' => [
444 'optionGroupName' => 'payment_instrument',
445 'optionEditPath' => 'civicrm/admin/options/payment_instrument',
446 ],
447 'add' => '4.3',
448 ],
449 'exported_date' => [
450 'name' => 'exported_date',
451 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME,
452 'title' => ts('Batch Exported Date'),
453 'where' => 'civicrm_batch.exported_date',
454 'table_name' => 'civicrm_batch',
455 'entity' => 'Batch',
456 'bao' => 'CRM_Batch_BAO_Batch',
457 'localizable' => 0,
458 'add' => '4.3',
459 ],
460 'data' => [
461 'name' => 'data',
462 'type' => CRM_Utils_Type::T_LONGTEXT,
463 'title' => ts('Batch Data'),
464 'description' => ts('cache entered data'),
465 'where' => 'civicrm_batch.data',
466 'table_name' => 'civicrm_batch',
467 'entity' => 'Batch',
468 'bao' => 'CRM_Batch_BAO_Batch',
469 'localizable' => 0,
470 'add' => '4.4',
471 ],
472 ];
473 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
474 }
475 return Civi::$statics[__CLASS__]['fields'];
476 }
477
478 /**
479 * Return a mapping from field-name to the corresponding key (as used in fields()).
480 *
481 * @return array
482 * Array(string $name => string $uniqueName).
483 */
484 public static function &fieldKeys() {
485 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
486 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
487 }
488 return Civi::$statics[__CLASS__]['fieldKeys'];
489 }
490
491 /**
492 * Returns the names of this table
493 *
494 * @return string
495 */
496 public static function getTableName() {
497 return CRM_Core_DAO::getLocaleTableName(self::$_tableName);
498 }
499
500 /**
501 * Returns if this table needs to be logged
502 *
503 * @return bool
504 */
505 public function getLog() {
506 return self::$_log;
507 }
508
509 /**
510 * Returns the list of fields that can be imported
511 *
512 * @param bool $prefix
513 *
514 * @return array
515 */
516 public static function &import($prefix = FALSE) {
517 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'batch', $prefix, []);
518 return $r;
519 }
520
521 /**
522 * Returns the list of fields that can be exported
523 *
524 * @param bool $prefix
525 *
526 * @return array
527 */
528 public static function &export($prefix = FALSE) {
529 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'batch', $prefix, []);
530 return $r;
531 }
532
533 /**
534 * Returns the list of indices
535 *
536 * @param bool $localize
537 *
538 * @return array
539 */
540 public static function indices($localize = TRUE) {
541 $indices = [
542 'UI_name' => [
543 'name' => 'UI_name',
544 'field' => [
545 0 => 'name',
546 ],
547 'localizable' => FALSE,
548 'unique' => TRUE,
549 'sig' => 'civicrm_batch::1::name',
550 ],
551 ];
552 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
553 }
554
555 }