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