Regenerate DAO files
[civicrm-core.git] / CRM / Price / DAO / PriceFieldValue.php
1 <?php
2
3 /**
4 * @package CRM
5 * @copyright CiviCRM LLC https://civicrm.org/licensing
6 *
7 * Generated from xml/schema/CRM/Price/PriceFieldValue.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:dfd666e126f31f5c1f5f9c7c47050d4f)
10 */
11
12 /**
13 * Database access object for the PriceFieldValue entity.
14 */
15 class CRM_Price_DAO_PriceFieldValue extends CRM_Core_DAO {
16 const EXT = 'civicrm';
17 const TABLE_ADDED = '3.3';
18 const COMPONENT = 'CiviContribute';
19
20 /**
21 * Static instance to hold the table name.
22 *
23 * @var string
24 */
25 public static $_tableName = 'civicrm_price_field_value';
26
27 /**
28 * Should CiviCRM log any modifications to this table in the civicrm_log table.
29 *
30 * @var bool
31 */
32 public static $_log = FALSE;
33
34 /**
35 * Price Field Value
36 *
37 * @var int
38 */
39 public $id;
40
41 /**
42 * FK to civicrm_price_field
43 *
44 * @var int
45 */
46 public $price_field_id;
47
48 /**
49 * Price field option name
50 *
51 * @var string
52 */
53 public $name;
54
55 /**
56 * Price field option label
57 *
58 * @var string
59 */
60 public $label;
61
62 /**
63 * Price field option description.
64 *
65 * @var text
66 */
67 public $description;
68
69 /**
70 * Price field option pre help text.
71 *
72 * @var text
73 */
74 public $help_pre;
75
76 /**
77 * Price field option post field help.
78 *
79 * @var text
80 */
81 public $help_post;
82
83 /**
84 * Price field option amount
85 *
86 * @var float
87 */
88 public $amount;
89
90 /**
91 * Number of participants per field option
92 *
93 * @var int
94 */
95 public $count;
96
97 /**
98 * Max number of participants per field options
99 *
100 * @var int
101 */
102 public $max_value;
103
104 /**
105 * Order in which the field options should appear
106 *
107 * @var int
108 */
109 public $weight;
110
111 /**
112 * FK to Membership Type
113 *
114 * @var int
115 */
116 public $membership_type_id;
117
118 /**
119 * Number of terms for this membership
120 *
121 * @var int
122 */
123 public $membership_num_terms;
124
125 /**
126 * Is this default price field option
127 *
128 * @var bool
129 */
130 public $is_default;
131
132 /**
133 * Is this price field value active
134 *
135 * @var bool
136 */
137 public $is_active;
138
139 /**
140 * FK to Financial Type.
141 *
142 * @var int
143 */
144 public $financial_type_id;
145
146 /**
147 * Portion of total amount which is NOT tax deductible.
148 *
149 * @var float
150 */
151 public $non_deductible_amount;
152
153 /**
154 * Implicit FK to civicrm_option_group with name = 'visibility'
155 *
156 * @var int
157 */
158 public $visibility_id;
159
160 /**
161 * Class constructor.
162 */
163 public function __construct() {
164 $this->__table = 'civicrm_price_field_value';
165 parent::__construct();
166 }
167
168 /**
169 * Returns localized title of this entity.
170 *
171 * @param bool $plural
172 * Whether to return the plural version of the title.
173 */
174 public static function getEntityTitle($plural = FALSE) {
175 return $plural ? ts('Price Field Values') : ts('Price Field Value');
176 }
177
178 /**
179 * Returns foreign keys and entity references.
180 *
181 * @return array
182 * [CRM_Core_Reference_Interface]
183 */
184 public static function getReferenceColumns() {
185 if (!isset(Civi::$statics[__CLASS__]['links'])) {
186 Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__);
187 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'price_field_id', 'civicrm_price_field', 'id');
188 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'membership_type_id', 'civicrm_membership_type', 'id');
189 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'financial_type_id', 'civicrm_financial_type', 'id');
190 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
191 }
192 return Civi::$statics[__CLASS__]['links'];
193 }
194
195 /**
196 * Returns all the column names of this table
197 *
198 * @return array
199 */
200 public static function &fields() {
201 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
202 Civi::$statics[__CLASS__]['fields'] = [
203 'id' => [
204 'name' => 'id',
205 'type' => CRM_Utils_Type::T_INT,
206 'title' => ts('Price Field Value ID'),
207 'description' => ts('Price Field Value'),
208 'required' => TRUE,
209 'where' => 'civicrm_price_field_value.id',
210 'table_name' => 'civicrm_price_field_value',
211 'entity' => 'PriceFieldValue',
212 'bao' => 'CRM_Price_BAO_PriceFieldValue',
213 'localizable' => 0,
214 'html' => [
215 'type' => 'Number',
216 ],
217 'add' => '3.3',
218 ],
219 'price_field_id' => [
220 'name' => 'price_field_id',
221 'type' => CRM_Utils_Type::T_INT,
222 'title' => ts('Price Field ID'),
223 'description' => ts('FK to civicrm_price_field'),
224 'required' => TRUE,
225 'where' => 'civicrm_price_field_value.price_field_id',
226 'table_name' => 'civicrm_price_field_value',
227 'entity' => 'PriceFieldValue',
228 'bao' => 'CRM_Price_BAO_PriceFieldValue',
229 'localizable' => 0,
230 'FKClassName' => 'CRM_Price_DAO_PriceField',
231 'html' => [
232 'label' => ts("Price Field"),
233 ],
234 'add' => '3.3',
235 ],
236 'name' => [
237 'name' => 'name',
238 'type' => CRM_Utils_Type::T_STRING,
239 'title' => ts('Name'),
240 'description' => ts('Price field option name'),
241 'maxlength' => 255,
242 'size' => CRM_Utils_Type::HUGE,
243 'where' => 'civicrm_price_field_value.name',
244 'default' => 'NULL',
245 'table_name' => 'civicrm_price_field_value',
246 'entity' => 'PriceFieldValue',
247 'bao' => 'CRM_Price_BAO_PriceFieldValue',
248 'localizable' => 0,
249 'html' => [
250 'type' => 'Text',
251 ],
252 'add' => '3.3',
253 ],
254 'label' => [
255 'name' => 'label',
256 'type' => CRM_Utils_Type::T_STRING,
257 'title' => ts('Label'),
258 'description' => ts('Price field option label'),
259 'maxlength' => 255,
260 'size' => CRM_Utils_Type::HUGE,
261 'where' => 'civicrm_price_field_value.label',
262 'default' => 'NULL',
263 'table_name' => 'civicrm_price_field_value',
264 'entity' => 'PriceFieldValue',
265 'bao' => 'CRM_Price_BAO_PriceFieldValue',
266 'localizable' => 1,
267 'html' => [
268 'type' => 'Text',
269 ],
270 'add' => '3.3',
271 ],
272 'description' => [
273 'name' => 'description',
274 'type' => CRM_Utils_Type::T_TEXT,
275 'title' => ts('Description'),
276 'description' => ts('Price field option description.'),
277 'rows' => 2,
278 'cols' => 60,
279 'where' => 'civicrm_price_field_value.description',
280 'default' => 'NULL',
281 'table_name' => 'civicrm_price_field_value',
282 'entity' => 'PriceFieldValue',
283 'bao' => 'CRM_Price_BAO_PriceFieldValue',
284 'localizable' => 1,
285 'html' => [
286 'type' => 'TextArea',
287 ],
288 'add' => '3.3',
289 ],
290 'help_pre' => [
291 'name' => 'help_pre',
292 'type' => CRM_Utils_Type::T_TEXT,
293 'title' => ts('Help Pre'),
294 'description' => ts('Price field option pre help text.'),
295 'rows' => 2,
296 'cols' => 60,
297 'where' => 'civicrm_price_field_value.help_pre',
298 'default' => 'NULL',
299 'table_name' => 'civicrm_price_field_value',
300 'entity' => 'PriceFieldValue',
301 'bao' => 'CRM_Price_BAO_PriceFieldValue',
302 'localizable' => 1,
303 'html' => [
304 'type' => 'TextArea',
305 ],
306 'add' => '4.7',
307 ],
308 'help_post' => [
309 'name' => 'help_post',
310 'type' => CRM_Utils_Type::T_TEXT,
311 'title' => ts('Help Post'),
312 'description' => ts('Price field option post field help.'),
313 'rows' => 2,
314 'cols' => 60,
315 'where' => 'civicrm_price_field_value.help_post',
316 'default' => 'NULL',
317 'table_name' => 'civicrm_price_field_value',
318 'entity' => 'PriceFieldValue',
319 'bao' => 'CRM_Price_BAO_PriceFieldValue',
320 'localizable' => 1,
321 'html' => [
322 'type' => 'TextArea',
323 ],
324 'add' => '4.7',
325 ],
326 'amount' => [
327 'name' => 'amount',
328 'type' => CRM_Utils_Type::T_MONEY,
329 'title' => ts('Amount'),
330 'description' => ts('Price field option amount'),
331 'required' => TRUE,
332 'precision' => [
333 18,
334 9,
335 ],
336 'where' => 'civicrm_price_field_value.amount',
337 'table_name' => 'civicrm_price_field_value',
338 'entity' => 'PriceFieldValue',
339 'bao' => 'CRM_Price_BAO_PriceFieldValue',
340 'localizable' => 0,
341 'html' => [
342 'type' => 'Text',
343 ],
344 'add' => '3.3',
345 ],
346 'count' => [
347 'name' => 'count',
348 'type' => CRM_Utils_Type::T_INT,
349 'title' => ts('Count'),
350 'description' => ts('Number of participants per field option'),
351 'where' => 'civicrm_price_field_value.count',
352 'default' => 'NULL',
353 'table_name' => 'civicrm_price_field_value',
354 'entity' => 'PriceFieldValue',
355 'bao' => 'CRM_Price_BAO_PriceFieldValue',
356 'localizable' => 0,
357 'html' => [
358 'type' => 'Text',
359 ],
360 'add' => '3.3',
361 ],
362 'max_value' => [
363 'name' => 'max_value',
364 'type' => CRM_Utils_Type::T_INT,
365 'title' => ts('Max Value'),
366 'description' => ts('Max number of participants per field options'),
367 'where' => 'civicrm_price_field_value.max_value',
368 'default' => 'NULL',
369 'table_name' => 'civicrm_price_field_value',
370 'entity' => 'PriceFieldValue',
371 'bao' => 'CRM_Price_BAO_PriceFieldValue',
372 'localizable' => 0,
373 'html' => [
374 'type' => 'Text',
375 ],
376 'add' => '3.3',
377 ],
378 'weight' => [
379 'name' => 'weight',
380 'type' => CRM_Utils_Type::T_INT,
381 'title' => ts('Order'),
382 'description' => ts('Order in which the field options should appear'),
383 'where' => 'civicrm_price_field_value.weight',
384 'default' => '1',
385 'table_name' => 'civicrm_price_field_value',
386 'entity' => 'PriceFieldValue',
387 'bao' => 'CRM_Price_BAO_PriceFieldValue',
388 'localizable' => 0,
389 'html' => [
390 'type' => 'Text',
391 ],
392 'add' => '3.3',
393 ],
394 'membership_type_id' => [
395 'name' => 'membership_type_id',
396 'type' => CRM_Utils_Type::T_INT,
397 'title' => ts('Membership Type ID'),
398 'description' => ts('FK to Membership Type'),
399 'where' => 'civicrm_price_field_value.membership_type_id',
400 'default' => 'NULL',
401 'table_name' => 'civicrm_price_field_value',
402 'entity' => 'PriceFieldValue',
403 'bao' => 'CRM_Price_BAO_PriceFieldValue',
404 'localizable' => 0,
405 'FKClassName' => 'CRM_Member_DAO_MembershipType',
406 'html' => [
407 'type' => 'Select',
408 'label' => ts("Membership Type"),
409 ],
410 'add' => '3.4',
411 ],
412 'membership_num_terms' => [
413 'name' => 'membership_num_terms',
414 'type' => CRM_Utils_Type::T_INT,
415 'title' => ts('Membership Num Terms'),
416 'description' => ts('Number of terms for this membership'),
417 'where' => 'civicrm_price_field_value.membership_num_terms',
418 'default' => 'NULL',
419 'table_name' => 'civicrm_price_field_value',
420 'entity' => 'PriceFieldValue',
421 'bao' => 'CRM_Price_BAO_PriceFieldValue',
422 'localizable' => 0,
423 'html' => [
424 'type' => 'Text',
425 ],
426 'add' => '4.3',
427 ],
428 'is_default' => [
429 'name' => 'is_default',
430 'type' => CRM_Utils_Type::T_BOOLEAN,
431 'title' => ts('Is Default Price Field Option?'),
432 'description' => ts('Is this default price field option'),
433 'where' => 'civicrm_price_field_value.is_default',
434 'default' => '0',
435 'table_name' => 'civicrm_price_field_value',
436 'entity' => 'PriceFieldValue',
437 'bao' => 'CRM_Price_BAO_PriceFieldValue',
438 'localizable' => 0,
439 'html' => [
440 'type' => 'CheckBox',
441 ],
442 'add' => '3.3',
443 ],
444 'is_active' => [
445 'name' => 'is_active',
446 'type' => CRM_Utils_Type::T_BOOLEAN,
447 'title' => ts('Price Field Value is Active'),
448 'description' => ts('Is this price field value active'),
449 'where' => 'civicrm_price_field_value.is_active',
450 'default' => '1',
451 'table_name' => 'civicrm_price_field_value',
452 'entity' => 'PriceFieldValue',
453 'bao' => 'CRM_Price_BAO_PriceFieldValue',
454 'localizable' => 0,
455 'add' => '3.3',
456 ],
457 'financial_type_id' => [
458 'name' => 'financial_type_id',
459 'type' => CRM_Utils_Type::T_INT,
460 'title' => ts('Financial Type ID'),
461 'description' => ts('FK to Financial Type.'),
462 'where' => 'civicrm_price_field_value.financial_type_id',
463 'default' => 'NULL',
464 'table_name' => 'civicrm_price_field_value',
465 'entity' => 'PriceFieldValue',
466 'bao' => 'CRM_Price_BAO_PriceFieldValue',
467 'localizable' => 0,
468 'FKClassName' => 'CRM_Financial_DAO_FinancialType',
469 'html' => [
470 'type' => 'Select',
471 'label' => ts("Financial Type"),
472 ],
473 'pseudoconstant' => [
474 'table' => 'civicrm_financial_type',
475 'keyColumn' => 'id',
476 'labelColumn' => 'name',
477 ],
478 'add' => '4.3',
479 ],
480 'non_deductible_amount' => [
481 'name' => 'non_deductible_amount',
482 'type' => CRM_Utils_Type::T_MONEY,
483 'title' => ts('Non-deductible Amount'),
484 'description' => ts('Portion of total amount which is NOT tax deductible.'),
485 'required' => TRUE,
486 'precision' => [
487 20,
488 2,
489 ],
490 'where' => 'civicrm_price_field_value.non_deductible_amount',
491 'headerPattern' => '/non?.?deduct/i',
492 'dataPattern' => '/^\d+(\.\d{2})?$/',
493 'default' => '0.0',
494 'table_name' => 'civicrm_price_field_value',
495 'entity' => 'PriceFieldValue',
496 'bao' => 'CRM_Price_BAO_PriceFieldValue',
497 'localizable' => 0,
498 'html' => [
499 'type' => 'Text',
500 ],
501 'add' => '4.7',
502 ],
503 'visibility_id' => [
504 'name' => 'visibility_id',
505 'type' => CRM_Utils_Type::T_INT,
506 'title' => ts('Price Field Option Visibility'),
507 'description' => ts('Implicit FK to civicrm_option_group with name = \'visibility\''),
508 'where' => 'civicrm_price_field_value.visibility_id',
509 'default' => '1',
510 'table_name' => 'civicrm_price_field_value',
511 'entity' => 'PriceFieldValue',
512 'bao' => 'CRM_Price_BAO_PriceFieldValue',
513 'localizable' => 0,
514 'html' => [
515 'type' => 'Select',
516 ],
517 'pseudoconstant' => [
518 'optionGroupName' => 'visibility',
519 'optionEditPath' => 'civicrm/admin/options/visibility',
520 ],
521 'add' => '4.7',
522 ],
523 ];
524 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
525 }
526 return Civi::$statics[__CLASS__]['fields'];
527 }
528
529 /**
530 * Return a mapping from field-name to the corresponding key (as used in fields()).
531 *
532 * @return array
533 * Array(string $name => string $uniqueName).
534 */
535 public static function &fieldKeys() {
536 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
537 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
538 }
539 return Civi::$statics[__CLASS__]['fieldKeys'];
540 }
541
542 /**
543 * Returns the names of this table
544 *
545 * @return string
546 */
547 public static function getTableName() {
548 return CRM_Core_DAO::getLocaleTableName(self::$_tableName);
549 }
550
551 /**
552 * Returns if this table needs to be logged
553 *
554 * @return bool
555 */
556 public function getLog() {
557 return self::$_log;
558 }
559
560 /**
561 * Returns the list of fields that can be imported
562 *
563 * @param bool $prefix
564 *
565 * @return array
566 */
567 public static function &import($prefix = FALSE) {
568 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'price_field_value', $prefix, []);
569 return $r;
570 }
571
572 /**
573 * Returns the list of fields that can be exported
574 *
575 * @param bool $prefix
576 *
577 * @return array
578 */
579 public static function &export($prefix = FALSE) {
580 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'price_field_value', $prefix, []);
581 return $r;
582 }
583
584 /**
585 * Returns the list of indices
586 *
587 * @param bool $localize
588 *
589 * @return array
590 */
591 public static function indices($localize = TRUE) {
592 $indices = [];
593 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
594 }
595
596 }