(NFC) Set _log and _table_name variables to be public
[civicrm-core.git] / CRM / Price / DAO / PriceFieldValue.php
1 <?php
2
3 /**
4 * @package CRM
5 * @copyright CiviCRM LLC (c) 2004-2019
6 *
7 * Generated from xml/schema/CRM/Price/PriceFieldValue.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:a3de204f039daa85984316fae2c60975)
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 unsigned
35 */
36 public $id;
37
38 /**
39 * FK to civicrm_price_field
40 *
41 * @var int unsigned
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 unsigned
91 */
92 public $count;
93
94 /**
95 * Max number of participants per field options
96 *
97 * @var int unsigned
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 unsigned
112 */
113 public $membership_type_id;
114
115 /**
116 * Number of terms for this membership
117 *
118 * @var int unsigned
119 */
120 public $membership_num_terms;
121
122 /**
123 * Is this default price field option
124 *
125 * @var boolean
126 */
127 public $is_default;
128
129 /**
130 * Is this price field value active
131 *
132 * @var boolean
133 */
134 public $is_active;
135
136 /**
137 * FK to Financial Type.
138 *
139 * @var int unsigned
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 unsigned
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 foreign keys and entity references.
167 *
168 * @return array
169 * [CRM_Core_Reference_Interface]
170 */
171 public static function getReferenceColumns() {
172 if (!isset(Civi::$statics[__CLASS__]['links'])) {
173 Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__);
174 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'price_field_id', 'civicrm_price_field', 'id');
175 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'membership_type_id', 'civicrm_membership_type', 'id');
176 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'financial_type_id', 'civicrm_financial_type', 'id');
177 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
178 }
179 return Civi::$statics[__CLASS__]['links'];
180 }
181
182 /**
183 * Returns all the column names of this table
184 *
185 * @return array
186 */
187 public static function &fields() {
188 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
189 Civi::$statics[__CLASS__]['fields'] = [
190 'id' => [
191 'name' => 'id',
192 'type' => CRM_Utils_Type::T_INT,
193 'title' => ts('Price Field Value ID'),
194 'description' => ts('Price Field Value'),
195 'required' => TRUE,
196 'table_name' => 'civicrm_price_field_value',
197 'entity' => 'PriceFieldValue',
198 'bao' => 'CRM_Price_BAO_PriceFieldValue',
199 'localizable' => 0,
200 ],
201 'price_field_id' => [
202 'name' => 'price_field_id',
203 'type' => CRM_Utils_Type::T_INT,
204 'title' => ts('Price Field'),
205 'description' => ts('FK to civicrm_price_field'),
206 'required' => TRUE,
207 'table_name' => 'civicrm_price_field_value',
208 'entity' => 'PriceFieldValue',
209 'bao' => 'CRM_Price_BAO_PriceFieldValue',
210 'localizable' => 0,
211 'FKClassName' => 'CRM_Price_DAO_PriceField',
212 ],
213 'name' => [
214 'name' => 'name',
215 'type' => CRM_Utils_Type::T_STRING,
216 'title' => ts('Name'),
217 'description' => ts('Price field option name'),
218 'maxlength' => 255,
219 'size' => CRM_Utils_Type::HUGE,
220 'table_name' => 'civicrm_price_field_value',
221 'entity' => 'PriceFieldValue',
222 'bao' => 'CRM_Price_BAO_PriceFieldValue',
223 'localizable' => 0,
224 'html' => [
225 'type' => 'Text',
226 ],
227 ],
228 'label' => [
229 'name' => 'label',
230 'type' => CRM_Utils_Type::T_STRING,
231 'title' => ts('Label'),
232 'description' => ts('Price field option label'),
233 'maxlength' => 255,
234 'size' => CRM_Utils_Type::HUGE,
235 'table_name' => 'civicrm_price_field_value',
236 'entity' => 'PriceFieldValue',
237 'bao' => 'CRM_Price_BAO_PriceFieldValue',
238 'localizable' => 1,
239 'html' => [
240 'type' => 'Text',
241 ],
242 ],
243 'description' => [
244 'name' => 'description',
245 'type' => CRM_Utils_Type::T_TEXT,
246 'title' => ts('Description'),
247 'description' => ts('Price field option description.'),
248 'rows' => 2,
249 'cols' => 60,
250 'default' => 'NULL',
251 'table_name' => 'civicrm_price_field_value',
252 'entity' => 'PriceFieldValue',
253 'bao' => 'CRM_Price_BAO_PriceFieldValue',
254 'localizable' => 1,
255 'html' => [
256 'type' => 'TextArea',
257 ],
258 ],
259 'help_pre' => [
260 'name' => 'help_pre',
261 'type' => CRM_Utils_Type::T_TEXT,
262 'title' => ts('Help Pre'),
263 'description' => ts('Price field option pre help text.'),
264 'rows' => 2,
265 'cols' => 60,
266 'default' => 'NULL',
267 'table_name' => 'civicrm_price_field_value',
268 'entity' => 'PriceFieldValue',
269 'bao' => 'CRM_Price_BAO_PriceFieldValue',
270 'localizable' => 1,
271 'html' => [
272 'type' => 'TextArea',
273 ],
274 ],
275 'help_post' => [
276 'name' => 'help_post',
277 'type' => CRM_Utils_Type::T_TEXT,
278 'title' => ts('Help Post'),
279 'description' => ts('Price field option post field help.'),
280 'rows' => 2,
281 'cols' => 60,
282 'default' => 'NULL',
283 'table_name' => 'civicrm_price_field_value',
284 'entity' => 'PriceFieldValue',
285 'bao' => 'CRM_Price_BAO_PriceFieldValue',
286 'localizable' => 1,
287 'html' => [
288 'type' => 'TextArea',
289 ],
290 ],
291 'amount' => [
292 'name' => 'amount',
293 'type' => CRM_Utils_Type::T_MONEY,
294 'title' => ts('Amount'),
295 'description' => ts('Price field option amount'),
296 'required' => TRUE,
297 'precision' => [
298 18,
299 9
300 ],
301 'table_name' => 'civicrm_price_field_value',
302 'entity' => 'PriceFieldValue',
303 'bao' => 'CRM_Price_BAO_PriceFieldValue',
304 'localizable' => 0,
305 'html' => [
306 'type' => 'Text',
307 ],
308 ],
309 'count' => [
310 'name' => 'count',
311 'type' => CRM_Utils_Type::T_INT,
312 'title' => ts('Count'),
313 'description' => ts('Number of participants per field option'),
314 'default' => 'NULL',
315 'table_name' => 'civicrm_price_field_value',
316 'entity' => 'PriceFieldValue',
317 'bao' => 'CRM_Price_BAO_PriceFieldValue',
318 'localizable' => 0,
319 'html' => [
320 'type' => 'Text',
321 ],
322 ],
323 'max_value' => [
324 'name' => 'max_value',
325 'type' => CRM_Utils_Type::T_INT,
326 'title' => ts('Max Value'),
327 'description' => ts('Max number of participants per field options'),
328 'default' => 'NULL',
329 'table_name' => 'civicrm_price_field_value',
330 'entity' => 'PriceFieldValue',
331 'bao' => 'CRM_Price_BAO_PriceFieldValue',
332 'localizable' => 0,
333 'html' => [
334 'type' => 'Text',
335 ],
336 ],
337 'weight' => [
338 'name' => 'weight',
339 'type' => CRM_Utils_Type::T_INT,
340 'title' => ts('Order'),
341 'description' => ts('Order in which the field options should appear'),
342 'default' => '1',
343 'table_name' => 'civicrm_price_field_value',
344 'entity' => 'PriceFieldValue',
345 'bao' => 'CRM_Price_BAO_PriceFieldValue',
346 'localizable' => 0,
347 'html' => [
348 'type' => 'Text',
349 ],
350 ],
351 'membership_type_id' => [
352 'name' => 'membership_type_id',
353 'type' => CRM_Utils_Type::T_INT,
354 'title' => ts('Membership Type'),
355 'description' => ts('FK to Membership Type'),
356 'default' => 'NULL',
357 'table_name' => 'civicrm_price_field_value',
358 'entity' => 'PriceFieldValue',
359 'bao' => 'CRM_Price_BAO_PriceFieldValue',
360 'localizable' => 0,
361 'FKClassName' => 'CRM_Member_DAO_MembershipType',
362 'html' => [
363 'type' => 'Select',
364 ],
365 ],
366 'membership_num_terms' => [
367 'name' => 'membership_num_terms',
368 'type' => CRM_Utils_Type::T_INT,
369 'title' => ts('Membership Num Terms'),
370 'description' => ts('Number of terms for this membership'),
371 'default' => 'NULL',
372 'table_name' => 'civicrm_price_field_value',
373 'entity' => 'PriceFieldValue',
374 'bao' => 'CRM_Price_BAO_PriceFieldValue',
375 'localizable' => 0,
376 'html' => [
377 'type' => 'Text',
378 ],
379 ],
380 'is_default' => [
381 'name' => 'is_default',
382 'type' => CRM_Utils_Type::T_BOOLEAN,
383 'title' => ts('Is Default Price Field Option?'),
384 'description' => ts('Is this default price field option'),
385 'default' => '0',
386 'table_name' => 'civicrm_price_field_value',
387 'entity' => 'PriceFieldValue',
388 'bao' => 'CRM_Price_BAO_PriceFieldValue',
389 'localizable' => 0,
390 'html' => [
391 'type' => 'CheckBox',
392 ],
393 ],
394 'is_active' => [
395 'name' => 'is_active',
396 'type' => CRM_Utils_Type::T_BOOLEAN,
397 'title' => ts('Price Field Value is Active'),
398 'description' => ts('Is this price field value active'),
399 'default' => '1',
400 'table_name' => 'civicrm_price_field_value',
401 'entity' => 'PriceFieldValue',
402 'bao' => 'CRM_Price_BAO_PriceFieldValue',
403 'localizable' => 0,
404 ],
405 'financial_type_id' => [
406 'name' => 'financial_type_id',
407 'type' => CRM_Utils_Type::T_INT,
408 'title' => ts('Financial Type'),
409 'description' => ts('FK to Financial Type.'),
410 'default' => 'NULL',
411 'table_name' => 'civicrm_price_field_value',
412 'entity' => 'PriceFieldValue',
413 'bao' => 'CRM_Price_BAO_PriceFieldValue',
414 'localizable' => 0,
415 'FKClassName' => 'CRM_Financial_DAO_FinancialType',
416 'html' => [
417 'type' => 'Select',
418 ],
419 'pseudoconstant' => [
420 'table' => 'civicrm_financial_type',
421 'keyColumn' => 'id',
422 'labelColumn' => 'name',
423 ]
424 ],
425 'non_deductible_amount' => [
426 'name' => 'non_deductible_amount',
427 'type' => CRM_Utils_Type::T_MONEY,
428 'title' => ts('Non-deductible Amount'),
429 'description' => ts('Portion of total amount which is NOT tax deductible.'),
430 'required' => TRUE,
431 'precision' => [
432 20,
433 2
434 ],
435 'default' => '0.0',
436 'table_name' => 'civicrm_price_field_value',
437 'entity' => 'PriceFieldValue',
438 'bao' => 'CRM_Price_BAO_PriceFieldValue',
439 'localizable' => 0,
440 'html' => [
441 'type' => 'Text',
442 ],
443 ],
444 'visibility_id' => [
445 'name' => 'visibility_id',
446 'type' => CRM_Utils_Type::T_INT,
447 'title' => ts('Price Field Option Visibility'),
448 'description' => ts('Implicit FK to civicrm_option_group with name = \'visibility\''),
449 'default' => '1',
450 'table_name' => 'civicrm_price_field_value',
451 'entity' => 'PriceFieldValue',
452 'bao' => 'CRM_Price_BAO_PriceFieldValue',
453 'localizable' => 0,
454 'html' => [
455 'type' => 'Select',
456 ],
457 'pseudoconstant' => [
458 'optionGroupName' => 'visibility',
459 'optionEditPath' => 'civicrm/admin/options/visibility',
460 ]
461 ],
462 ];
463 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
464 }
465 return Civi::$statics[__CLASS__]['fields'];
466 }
467
468 /**
469 * Return a mapping from field-name to the corresponding key (as used in fields()).
470 *
471 * @return array
472 * Array(string $name => string $uniqueName).
473 */
474 public static function &fieldKeys() {
475 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
476 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
477 }
478 return Civi::$statics[__CLASS__]['fieldKeys'];
479 }
480
481 /**
482 * Returns the names of this table
483 *
484 * @return string
485 */
486 public static function getTableName() {
487 return CRM_Core_DAO::getLocaleTableName(self::$_tableName);
488 }
489
490 /**
491 * Returns if this table needs to be logged
492 *
493 * @return bool
494 */
495 public function getLog() {
496 return self::$_log;
497 }
498
499 /**
500 * Returns the list of fields that can be imported
501 *
502 * @param bool $prefix
503 *
504 * @return array
505 */
506 public static function &import($prefix = FALSE) {
507 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'price_field_value', $prefix, []);
508 return $r;
509 }
510
511 /**
512 * Returns the list of fields that can be exported
513 *
514 * @param bool $prefix
515 *
516 * @return array
517 */
518 public static function &export($prefix = FALSE) {
519 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'price_field_value', $prefix, []);
520 return $r;
521 }
522
523 /**
524 * Returns the list of indices
525 *
526 * @param bool $localize
527 *
528 * @return array
529 */
530 public static function indices($localize = TRUE) {
531 $indices = [];
532 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
533 }
534
535 }