5 * @copyright CiviCRM LLC https://civicrm.org/licensing
7 * Generated from xml/schema/CRM/Price/PriceFieldValue.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:d39a35fbdcaed47315fdc0ecce662c7f)
13 * Database access object for the PriceFieldValue entity.
15 class CRM_Price_DAO_PriceFieldValue
extends CRM_Core_DAO
{
16 const EXT
= 'civicrm';
17 const TABLE_ADDED
= '3.3';
18 const COMPONENT
= 'CiviContribute';
21 * Static instance to hold the table name.
25 public static $_tableName = 'civicrm_price_field_value';
28 * Should CiviCRM log any modifications to this table in the civicrm_log table.
32 public static $_log = FALSE;
37 * @var int|string|null
38 * (SQL type: int unsigned)
39 * Note that values will be retrieved from the database as a string.
44 * FK to civicrm_price_field
47 * (SQL type: int unsigned)
48 * Note that values will be retrieved from the database as a string.
50 public $price_field_id;
53 * Price field option name
56 * (SQL type: varchar(255))
57 * Note that values will be retrieved from the database as a string.
62 * Price field option label
65 * (SQL type: varchar(255))
66 * Note that values will be retrieved from the database as a string.
71 * Price field option description.
75 * Note that values will be retrieved from the database as a string.
80 * Price field option pre help text.
84 * Note that values will be retrieved from the database as a string.
89 * Price field option post field help.
93 * Note that values will be retrieved from the database as a string.
98 * Price field option amount
101 * (SQL type: decimal(18,9))
102 * Note that values will be retrieved from the database as a string.
107 * Number of participants per field option
109 * @var int|string|null
110 * (SQL type: int unsigned)
111 * Note that values will be retrieved from the database as a string.
116 * Max number of participants per field options
118 * @var int|string|null
119 * (SQL type: int unsigned)
120 * Note that values will be retrieved from the database as a string.
125 * Order in which the field options should appear
127 * @var int|string|null
129 * Note that values will be retrieved from the database as a string.
134 * FK to Membership Type
136 * @var int|string|null
137 * (SQL type: int unsigned)
138 * Note that values will be retrieved from the database as a string.
140 public $membership_type_id;
143 * Number of terms for this membership
145 * @var int|string|null
146 * (SQL type: int unsigned)
147 * Note that values will be retrieved from the database as a string.
149 public $membership_num_terms;
152 * Is this default price field option
155 * (SQL type: tinyint)
156 * Note that values will be retrieved from the database as a string.
161 * Is this price field value active
164 * (SQL type: tinyint)
165 * Note that values will be retrieved from the database as a string.
170 * FK to Financial Type.
172 * @var int|string|null
173 * (SQL type: int unsigned)
174 * Note that values will be retrieved from the database as a string.
176 public $financial_type_id;
179 * Portion of total amount which is NOT tax deductible.
182 * (SQL type: decimal(20,2))
183 * Note that values will be retrieved from the database as a string.
185 public $non_deductible_amount;
188 * Implicit FK to civicrm_option_group with name = 'visibility'
190 * @var int|string|null
191 * (SQL type: int unsigned)
192 * Note that values will be retrieved from the database as a string.
194 public $visibility_id;
199 public function __construct() {
200 $this->__table
= 'civicrm_price_field_value';
201 parent
::__construct();
205 * Returns localized title of this entity.
207 * @param bool $plural
208 * Whether to return the plural version of the title.
210 public static function getEntityTitle($plural = FALSE) {
211 return $plural ?
ts('Price Field Values') : ts('Price Field Value');
215 * Returns foreign keys and entity references.
218 * [CRM_Core_Reference_Interface]
220 public static function getReferenceColumns() {
221 if (!isset(Civi
::$statics[__CLASS__
]['links'])) {
222 Civi
::$statics[__CLASS__
]['links'] = static::createReferenceColumns(__CLASS__
);
223 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'price_field_id', 'civicrm_price_field', 'id');
224 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'membership_type_id', 'civicrm_membership_type', 'id');
225 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'financial_type_id', 'civicrm_financial_type', 'id');
226 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'links_callback', Civi
::$statics[__CLASS__
]['links']);
228 return Civi
::$statics[__CLASS__
]['links'];
232 * Returns all the column names of this table
236 public static function &fields() {
237 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
238 Civi
::$statics[__CLASS__
]['fields'] = [
241 'type' => CRM_Utils_Type
::T_INT
,
242 'title' => ts('Price Field Value ID'),
243 'description' => ts('Price Field Value'),
245 'where' => 'civicrm_price_field_value.id',
246 'table_name' => 'civicrm_price_field_value',
247 'entity' => 'PriceFieldValue',
248 'bao' => 'CRM_Price_BAO_PriceFieldValue',
256 'price_field_id' => [
257 'name' => 'price_field_id',
258 'type' => CRM_Utils_Type
::T_INT
,
259 'title' => ts('Price Field ID'),
260 'description' => ts('FK to civicrm_price_field'),
262 'where' => 'civicrm_price_field_value.price_field_id',
263 'table_name' => 'civicrm_price_field_value',
264 'entity' => 'PriceFieldValue',
265 'bao' => 'CRM_Price_BAO_PriceFieldValue',
267 'FKClassName' => 'CRM_Price_DAO_PriceField',
269 'label' => ts("Price Field"),
275 'type' => CRM_Utils_Type
::T_STRING
,
276 'title' => ts('Name'),
277 'description' => ts('Price field option name'),
279 'size' => CRM_Utils_Type
::HUGE
,
280 'where' => 'civicrm_price_field_value.name',
282 'table_name' => 'civicrm_price_field_value',
283 'entity' => 'PriceFieldValue',
284 'bao' => 'CRM_Price_BAO_PriceFieldValue',
293 'type' => CRM_Utils_Type
::T_STRING
,
294 'title' => ts('Label'),
295 'description' => ts('Price field option label'),
297 'size' => CRM_Utils_Type
::HUGE
,
298 'where' => 'civicrm_price_field_value.label',
300 'table_name' => 'civicrm_price_field_value',
301 'entity' => 'PriceFieldValue',
302 'bao' => 'CRM_Price_BAO_PriceFieldValue',
310 'name' => 'description',
311 'type' => CRM_Utils_Type
::T_TEXT
,
312 'title' => ts('Description'),
313 'description' => ts('Price field option description.'),
316 'where' => 'civicrm_price_field_value.description',
318 'table_name' => 'civicrm_price_field_value',
319 'entity' => 'PriceFieldValue',
320 'bao' => 'CRM_Price_BAO_PriceFieldValue',
323 'type' => 'TextArea',
324 'label' => ts("Description"),
329 'name' => 'help_pre',
330 'type' => CRM_Utils_Type
::T_TEXT
,
331 'title' => ts('Help Pre'),
332 'description' => ts('Price field option pre help text.'),
335 'where' => 'civicrm_price_field_value.help_pre',
337 'table_name' => 'civicrm_price_field_value',
338 'entity' => 'PriceFieldValue',
339 'bao' => 'CRM_Price_BAO_PriceFieldValue',
342 'type' => 'TextArea',
343 'label' => ts("Pre Help"),
348 'name' => 'help_post',
349 'type' => CRM_Utils_Type
::T_TEXT
,
350 'title' => ts('Help Post'),
351 'description' => ts('Price field option post field help.'),
354 'where' => 'civicrm_price_field_value.help_post',
356 'table_name' => 'civicrm_price_field_value',
357 'entity' => 'PriceFieldValue',
358 'bao' => 'CRM_Price_BAO_PriceFieldValue',
361 'type' => 'TextArea',
362 'label' => ts("Post Help"),
368 'type' => CRM_Utils_Type
::T_MONEY
,
369 'title' => ts('Amount'),
370 'description' => ts('Price field option amount'),
376 'where' => 'civicrm_price_field_value.amount',
377 'table_name' => 'civicrm_price_field_value',
378 'entity' => 'PriceFieldValue',
379 'bao' => 'CRM_Price_BAO_PriceFieldValue',
388 'type' => CRM_Utils_Type
::T_INT
,
389 'title' => ts('Count'),
390 'description' => ts('Number of participants per field option'),
391 'where' => 'civicrm_price_field_value.count',
393 'table_name' => 'civicrm_price_field_value',
394 'entity' => 'PriceFieldValue',
395 'bao' => 'CRM_Price_BAO_PriceFieldValue',
399 'label' => ts("Count"),
404 'name' => 'max_value',
405 'type' => CRM_Utils_Type
::T_INT
,
406 'title' => ts('Max Value'),
407 'description' => ts('Max number of participants per field options'),
408 'where' => 'civicrm_price_field_value.max_value',
410 'table_name' => 'civicrm_price_field_value',
411 'entity' => 'PriceFieldValue',
412 'bao' => 'CRM_Price_BAO_PriceFieldValue',
416 'label' => ts("Max Value"),
422 'type' => CRM_Utils_Type
::T_INT
,
423 'title' => ts('Order'),
424 'description' => ts('Order in which the field options should appear'),
425 'where' => 'civicrm_price_field_value.weight',
427 'table_name' => 'civicrm_price_field_value',
428 'entity' => 'PriceFieldValue',
429 'bao' => 'CRM_Price_BAO_PriceFieldValue',
436 'membership_type_id' => [
437 'name' => 'membership_type_id',
438 'type' => CRM_Utils_Type
::T_INT
,
439 'title' => ts('Membership Type ID'),
440 'description' => ts('FK to Membership Type'),
441 'where' => 'civicrm_price_field_value.membership_type_id',
443 'table_name' => 'civicrm_price_field_value',
444 'entity' => 'PriceFieldValue',
445 'bao' => 'CRM_Price_BAO_PriceFieldValue',
447 'FKClassName' => 'CRM_Member_DAO_MembershipType',
450 'label' => ts("Membership Type"),
454 'membership_num_terms' => [
455 'name' => 'membership_num_terms',
456 'type' => CRM_Utils_Type
::T_INT
,
457 'title' => ts('Membership Num Terms'),
458 'description' => ts('Number of terms for this membership'),
459 'where' => 'civicrm_price_field_value.membership_num_terms',
461 'table_name' => 'civicrm_price_field_value',
462 'entity' => 'PriceFieldValue',
463 'bao' => 'CRM_Price_BAO_PriceFieldValue',
467 'label' => ts("Number of terms"),
472 'name' => 'is_default',
473 'type' => CRM_Utils_Type
::T_BOOLEAN
,
474 'title' => ts('Is Default Price Field Option?'),
475 'description' => ts('Is this default price field option'),
477 'where' => 'civicrm_price_field_value.is_default',
479 'table_name' => 'civicrm_price_field_value',
480 'entity' => 'PriceFieldValue',
481 'bao' => 'CRM_Price_BAO_PriceFieldValue',
484 'type' => 'CheckBox',
489 'name' => 'is_active',
490 'type' => CRM_Utils_Type
::T_BOOLEAN
,
491 'title' => ts('Price Field Value is Active'),
492 'description' => ts('Is this price field value active'),
494 'where' => 'civicrm_price_field_value.is_active',
496 'table_name' => 'civicrm_price_field_value',
497 'entity' => 'PriceFieldValue',
498 'bao' => 'CRM_Price_BAO_PriceFieldValue',
502 'financial_type_id' => [
503 'name' => 'financial_type_id',
504 'type' => CRM_Utils_Type
::T_INT
,
505 'title' => ts('Financial Type ID'),
506 'description' => ts('FK to Financial Type.'),
507 'where' => 'civicrm_price_field_value.financial_type_id',
509 'table_name' => 'civicrm_price_field_value',
510 'entity' => 'PriceFieldValue',
511 'bao' => 'CRM_Price_BAO_PriceFieldValue',
513 'FKClassName' => 'CRM_Financial_DAO_FinancialType',
516 'label' => ts("Financial Type"),
518 'pseudoconstant' => [
519 'table' => 'civicrm_financial_type',
521 'labelColumn' => 'name',
525 'non_deductible_amount' => [
526 'name' => 'non_deductible_amount',
527 'type' => CRM_Utils_Type
::T_MONEY
,
528 'title' => ts('Non-deductible Amount'),
529 'description' => ts('Portion of total amount which is NOT tax deductible.'),
535 'where' => 'civicrm_price_field_value.non_deductible_amount',
536 'headerPattern' => '/non?.?deduct/i',
537 'dataPattern' => '/^\d+(\.\d{2})?$/',
539 'table_name' => 'civicrm_price_field_value',
540 'entity' => 'PriceFieldValue',
541 'bao' => 'CRM_Price_BAO_PriceFieldValue',
549 'name' => 'visibility_id',
550 'type' => CRM_Utils_Type
::T_INT
,
551 'title' => ts('Price Field Option Visibility'),
552 'description' => ts('Implicit FK to civicrm_option_group with name = \'visibility\''),
553 'where' => 'civicrm_price_field_value.visibility_id',
555 'table_name' => 'civicrm_price_field_value',
556 'entity' => 'PriceFieldValue',
557 'bao' => 'CRM_Price_BAO_PriceFieldValue',
562 'pseudoconstant' => [
563 'optionGroupName' => 'visibility',
564 'optionEditPath' => 'civicrm/admin/options/visibility',
569 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
571 return Civi
::$statics[__CLASS__
]['fields'];
575 * Return a mapping from field-name to the corresponding key (as used in fields()).
578 * Array(string $name => string $uniqueName).
580 public static function &fieldKeys() {
581 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
582 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
584 return Civi
::$statics[__CLASS__
]['fieldKeys'];
588 * Returns the names of this table
592 public static function getTableName() {
593 return CRM_Core_DAO
::getLocaleTableName(self
::$_tableName);
597 * Returns if this table needs to be logged
601 public function getLog() {
606 * Returns the list of fields that can be imported
608 * @param bool $prefix
612 public static function &import($prefix = FALSE) {
613 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'price_field_value', $prefix, []);
618 * Returns the list of fields that can be exported
620 * @param bool $prefix
624 public static function &export($prefix = FALSE) {
625 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'price_field_value', $prefix, []);
630 * Returns the list of indices
632 * @param bool $localize
636 public static function indices($localize = TRUE) {
638 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;