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