CRM-20312 Add indices to DAO classes
[civicrm-core.git] / CRM / Price / DAO / PriceFieldValue.php
CommitLineData
e501603b
TO
1<?php
2/*
3+--------------------------------------------------------------------+
4| CiviCRM version 4.7 |
5+--------------------------------------------------------------------+
0f03f337 6| Copyright CiviCRM LLC (c) 2004-2017 |
e501603b
TO
7+--------------------------------------------------------------------+
8| This file is a part of CiviCRM. |
9| |
10| CiviCRM is free software; you can copy, modify, and distribute it |
11| under the terms of the GNU Affero General Public License |
12| Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
13| |
14| CiviCRM is distributed in the hope that it will be useful, but |
15| WITHOUT ANY WARRANTY; without even the implied warranty of |
16| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
17| See the GNU Affero General Public License for more details. |
18| |
19| You should have received a copy of the GNU Affero General Public |
20| License and the CiviCRM Licensing Exception along |
21| with this program; if not, contact CiviCRM LLC |
22| at info[AT]civicrm[DOT]org. If you have questions about the |
23| GNU Affero General Public License or the licensing of CiviCRM, |
24| see the CiviCRM license FAQ at http://civicrm.org/licensing |
25+--------------------------------------------------------------------+
26*/
27/**
28 * @package CRM
0f03f337 29 * @copyright CiviCRM LLC (c) 2004-2017
e501603b
TO
30 *
31 * Generated from xml/schema/CRM/Price/PriceFieldValue.xml
32 * DO NOT EDIT. Generated by CRM_Core_CodeGen
6a7e5e5d 33 * (GenCodeChecksum:44b920e4a8091f16a96990834a24c288)
e501603b
TO
34 */
35require_once 'CRM/Core/DAO.php';
36require_once 'CRM/Utils/Type.php';
f41f0342 37/**
38 * CRM_Price_DAO_PriceFieldValue constructor.
39 */
e501603b
TO
40class CRM_Price_DAO_PriceFieldValue extends CRM_Core_DAO {
41 /**
f41f0342 42 * Static instance to hold the table name.
e501603b
TO
43 *
44 * @var string
45 */
46 static $_tableName = 'civicrm_price_field_value';
e501603b 47 /**
f41f0342 48 * Should CiviCRM log any modifications to this table in the civicrm_log table.
e501603b
TO
49 *
50 * @var boolean
51 */
52 static $_log = false;
53 /**
54 * Price Field Value
55 *
56 * @var int unsigned
57 */
58 public $id;
59 /**
60 * FK to civicrm_price_field
61 *
62 * @var int unsigned
63 */
64 public $price_field_id;
65 /**
66 * Price field option name
67 *
68 * @var string
69 */
70 public $name;
71 /**
72 * Price field option label
73 *
74 * @var string
75 */
76 public $label;
77 /**
78 * >Price field option description.
79 *
80 * @var text
81 */
82 public $description;
83 /**
84 * Price field option pre help text.
85 *
86 * @var text
87 */
88 public $help_pre;
89 /**
90 * Price field option post field help.
91 *
92 * @var text
93 */
94 public $help_post;
95 /**
96 * Price field option amount
97 *
98 * @var string
99 */
100 public $amount;
101 /**
102 * Number of participants per field option
103 *
104 * @var int unsigned
105 */
106 public $count;
107 /**
108 * Max number of participants per field options
109 *
110 * @var int unsigned
111 */
112 public $max_value;
113 /**
114 * Order in which the field options should appear
115 *
116 * @var int
117 */
118 public $weight;
119 /**
120 * FK to Membership Type
121 *
122 * @var int unsigned
123 */
124 public $membership_type_id;
125 /**
126 * Number of terms for this membership
127 *
128 * @var int unsigned
129 */
130 public $membership_num_terms;
131 /**
132 * Is this default price field option
133 *
134 * @var boolean
135 */
136 public $is_default;
137 /**
138 * Is this price field value active
139 *
140 * @var boolean
141 */
142 public $is_active;
143 /**
144 * FK to Financial Type.
145 *
146 * @var int unsigned
147 */
148 public $financial_type_id;
149 /**
5afce5ad 150 * Portion of total amount which is NOT tax deductible.
e501603b
TO
151 *
152 * @var float
153 */
5afce5ad 154 public $non_deductible_amount;
e501603b 155 /**
f41f0342 156 * Class constructor.
e501603b
TO
157 */
158 function __construct() {
159 $this->__table = 'civicrm_price_field_value';
160 parent::__construct();
161 }
162 /**
f41f0342 163 * Returns foreign keys and entity references.
e501603b
TO
164 *
165 * @return array
166 * [CRM_Core_Reference_Interface]
167 */
168 static function getReferenceColumns() {
346aaaba
TO
169 if (!isset(Civi::$statics[__CLASS__]['links'])) {
170 Civi::$statics[__CLASS__]['links'] = static ::createReferenceColumns(__CLASS__);
171 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'price_field_id', 'civicrm_price_field', 'id');
172 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'membership_type_id', 'civicrm_membership_type', 'id');
173 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'financial_type_id', 'civicrm_financial_type', 'id');
174 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
e501603b 175 }
346aaaba 176 return Civi::$statics[__CLASS__]['links'];
e501603b
TO
177 }
178 /**
179 * Returns all the column names of this table
180 *
181 * @return array
182 */
183 static function &fields() {
346aaaba
TO
184 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
185 Civi::$statics[__CLASS__]['fields'] = array(
e501603b
TO
186 'id' => array(
187 'name' => 'id',
188 'type' => CRM_Utils_Type::T_INT,
189 'title' => ts('Price Field Value ID') ,
190 'description' => 'Price Field Value',
191 'required' => true,
522a26c9 192 'table_name' => 'civicrm_price_field_value',
193 'entity' => 'PriceFieldValue',
194 'bao' => 'CRM_Price_BAO_PriceFieldValue',
6a7e5e5d 195 'localizable' => 0,
e501603b
TO
196 ) ,
197 'price_field_id' => array(
198 'name' => 'price_field_id',
199 'type' => CRM_Utils_Type::T_INT,
200 'title' => ts('Price Field') ,
201 'description' => 'FK to civicrm_price_field',
202 'required' => true,
522a26c9 203 'table_name' => 'civicrm_price_field_value',
204 'entity' => 'PriceFieldValue',
205 'bao' => 'CRM_Price_BAO_PriceFieldValue',
6a7e5e5d 206 'localizable' => 0,
e501603b
TO
207 'FKClassName' => 'CRM_Price_DAO_PriceField',
208 ) ,
209 'name' => array(
210 'name' => 'name',
211 'type' => CRM_Utils_Type::T_STRING,
212 'title' => ts('Name') ,
213 'description' => 'Price field option name',
214 'maxlength' => 255,
215 'size' => CRM_Utils_Type::HUGE,
522a26c9 216 'table_name' => 'civicrm_price_field_value',
217 'entity' => 'PriceFieldValue',
218 'bao' => 'CRM_Price_BAO_PriceFieldValue',
6a7e5e5d 219 'localizable' => 0,
e501603b
TO
220 'html' => array(
221 'type' => 'Text',
222 ) ,
223 ) ,
224 'label' => array(
225 'name' => 'label',
226 'type' => CRM_Utils_Type::T_STRING,
227 'title' => ts('Label') ,
228 'description' => 'Price field option label',
229 'maxlength' => 255,
230 'size' => CRM_Utils_Type::HUGE,
522a26c9 231 'table_name' => 'civicrm_price_field_value',
232 'entity' => 'PriceFieldValue',
233 'bao' => 'CRM_Price_BAO_PriceFieldValue',
6a7e5e5d 234 'localizable' => 1,
e501603b
TO
235 'html' => array(
236 'type' => 'Text',
237 ) ,
238 ) ,
239 'description' => array(
240 'name' => 'description',
241 'type' => CRM_Utils_Type::T_TEXT,
242 'title' => ts('Description') ,
243 'description' => '>Price field option description.',
244 'rows' => 2,
245 'cols' => 60,
246 'default' => 'NULL',
522a26c9 247 'table_name' => 'civicrm_price_field_value',
248 'entity' => 'PriceFieldValue',
249 'bao' => 'CRM_Price_BAO_PriceFieldValue',
6a7e5e5d 250 'localizable' => 1,
e501603b
TO
251 'html' => array(
252 'type' => 'TextArea',
253 ) ,
254 ) ,
255 'help_pre' => array(
256 'name' => 'help_pre',
257 'type' => CRM_Utils_Type::T_TEXT,
258 'title' => ts('Help Pre') ,
259 'description' => 'Price field option pre help text.',
260 'rows' => 2,
261 'cols' => 60,
262 'default' => 'NULL',
522a26c9 263 'table_name' => 'civicrm_price_field_value',
264 'entity' => 'PriceFieldValue',
265 'bao' => 'CRM_Price_BAO_PriceFieldValue',
6a7e5e5d 266 'localizable' => 1,
e501603b
TO
267 'html' => array(
268 'type' => 'TextArea',
269 ) ,
270 ) ,
271 'help_post' => array(
272 'name' => 'help_post',
273 'type' => CRM_Utils_Type::T_TEXT,
274 'title' => ts('Help Post') ,
275 'description' => 'Price field option post field help.',
276 'rows' => 2,
277 'cols' => 60,
278 'default' => 'NULL',
522a26c9 279 'table_name' => 'civicrm_price_field_value',
280 'entity' => 'PriceFieldValue',
281 'bao' => 'CRM_Price_BAO_PriceFieldValue',
6a7e5e5d 282 'localizable' => 1,
e501603b
TO
283 'html' => array(
284 'type' => 'TextArea',
285 ) ,
286 ) ,
287 'amount' => array(
288 'name' => 'amount',
289 'type' => CRM_Utils_Type::T_STRING,
290 'title' => ts('Amount') ,
291 'description' => 'Price field option amount',
292 'required' => true,
293 'maxlength' => 512,
294 'size' => 8,
522a26c9 295 'table_name' => 'civicrm_price_field_value',
296 'entity' => 'PriceFieldValue',
297 'bao' => 'CRM_Price_BAO_PriceFieldValue',
6a7e5e5d 298 'localizable' => 0,
e501603b
TO
299 'html' => array(
300 'type' => 'Text',
301 ) ,
302 ) ,
303 'count' => array(
304 'name' => 'count',
305 'type' => CRM_Utils_Type::T_INT,
306 'title' => ts('Count') ,
307 'description' => 'Number of participants per field option',
308 'default' => 'NULL',
522a26c9 309 'table_name' => 'civicrm_price_field_value',
310 'entity' => 'PriceFieldValue',
311 'bao' => 'CRM_Price_BAO_PriceFieldValue',
6a7e5e5d 312 'localizable' => 0,
e501603b
TO
313 'html' => array(
314 'type' => 'Text',
315 ) ,
316 ) ,
317 'max_value' => array(
318 'name' => 'max_value',
319 'type' => CRM_Utils_Type::T_INT,
320 'title' => ts('Max Value') ,
321 'description' => 'Max number of participants per field options',
322 'default' => 'NULL',
522a26c9 323 'table_name' => 'civicrm_price_field_value',
324 'entity' => 'PriceFieldValue',
325 'bao' => 'CRM_Price_BAO_PriceFieldValue',
6a7e5e5d 326 'localizable' => 0,
e501603b
TO
327 'html' => array(
328 'type' => 'Text',
329 ) ,
330 ) ,
331 'weight' => array(
332 'name' => 'weight',
333 'type' => CRM_Utils_Type::T_INT,
334 'title' => ts('Order') ,
335 'description' => 'Order in which the field options should appear',
336 'default' => '1',
522a26c9 337 'table_name' => 'civicrm_price_field_value',
338 'entity' => 'PriceFieldValue',
339 'bao' => 'CRM_Price_BAO_PriceFieldValue',
6a7e5e5d 340 'localizable' => 0,
e501603b
TO
341 'html' => array(
342 'type' => 'Text',
343 ) ,
344 ) ,
345 'membership_type_id' => array(
346 'name' => 'membership_type_id',
347 'type' => CRM_Utils_Type::T_INT,
348 'title' => ts('Membership Type') ,
349 'description' => 'FK to Membership Type',
350 'default' => 'NULL',
522a26c9 351 'table_name' => 'civicrm_price_field_value',
352 'entity' => 'PriceFieldValue',
353 'bao' => 'CRM_Price_BAO_PriceFieldValue',
6a7e5e5d 354 'localizable' => 0,
e501603b
TO
355 'FKClassName' => 'CRM_Member_DAO_MembershipType',
356 'html' => array(
357 'type' => 'Select',
358 ) ,
359 ) ,
360 'membership_num_terms' => array(
361 'name' => 'membership_num_terms',
362 'type' => CRM_Utils_Type::T_INT,
363 'title' => ts('Membership Num Terms') ,
364 'description' => 'Number of terms for this membership',
365 'default' => 'NULL',
522a26c9 366 'table_name' => 'civicrm_price_field_value',
367 'entity' => 'PriceFieldValue',
368 'bao' => 'CRM_Price_BAO_PriceFieldValue',
6a7e5e5d 369 'localizable' => 0,
e501603b
TO
370 'html' => array(
371 'type' => 'Text',
372 ) ,
373 ) ,
374 'is_default' => array(
375 'name' => 'is_default',
376 'type' => CRM_Utils_Type::T_BOOLEAN,
377 'title' => ts('Is Default Price Field Option?') ,
378 'description' => 'Is this default price field option',
522a26c9 379 'table_name' => 'civicrm_price_field_value',
380 'entity' => 'PriceFieldValue',
381 'bao' => 'CRM_Price_BAO_PriceFieldValue',
6a7e5e5d 382 'localizable' => 0,
e501603b
TO
383 'html' => array(
384 'type' => 'CheckBox',
385 ) ,
386 ) ,
387 'is_active' => array(
388 'name' => 'is_active',
389 'type' => CRM_Utils_Type::T_BOOLEAN,
390 'title' => ts('Price Field Value is Active') ,
391 'description' => 'Is this price field value active',
392 'default' => '1',
522a26c9 393 'table_name' => 'civicrm_price_field_value',
394 'entity' => 'PriceFieldValue',
395 'bao' => 'CRM_Price_BAO_PriceFieldValue',
6a7e5e5d 396 'localizable' => 0,
e501603b
TO
397 ) ,
398 'financial_type_id' => array(
399 'name' => 'financial_type_id',
400 'type' => CRM_Utils_Type::T_INT,
401 'title' => ts('Financial Type') ,
402 'description' => 'FK to Financial Type.',
403 'default' => 'NULL',
522a26c9 404 'table_name' => 'civicrm_price_field_value',
405 'entity' => 'PriceFieldValue',
406 'bao' => 'CRM_Price_BAO_PriceFieldValue',
6a7e5e5d 407 'localizable' => 0,
e501603b
TO
408 'FKClassName' => 'CRM_Financial_DAO_FinancialType',
409 'html' => array(
410 'type' => 'Select',
411 ) ,
412 'pseudoconstant' => array(
413 'table' => 'civicrm_financial_type',
414 'keyColumn' => 'id',
415 'labelColumn' => 'name',
416 )
417 ) ,
5afce5ad 418 'non_deductible_amount' => array(
419 'name' => 'non_deductible_amount',
e501603b 420 'type' => CRM_Utils_Type::T_MONEY,
5afce5ad 421 'title' => ts('Non-deductible Amount') ,
422 'description' => 'Portion of total amount which is NOT tax deductible.',
e501603b
TO
423 'required' => true,
424 'precision' => array(
425 20,
426 2
427 ) ,
428 'default' => '0.0',
522a26c9 429 'table_name' => 'civicrm_price_field_value',
430 'entity' => 'PriceFieldValue',
431 'bao' => 'CRM_Price_BAO_PriceFieldValue',
6a7e5e5d 432 'localizable' => 0,
e501603b
TO
433 'html' => array(
434 'type' => 'Text',
435 ) ,
436 ) ,
437 );
346aaaba 438 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
e501603b 439 }
346aaaba 440 return Civi::$statics[__CLASS__]['fields'];
e501603b
TO
441 }
442 /**
bd8e0b14 443 * Return a mapping from field-name to the corresponding key (as used in fields()).
e501603b
TO
444 *
445 * @return array
bd8e0b14 446 * Array(string $name => string $uniqueName).
e501603b
TO
447 */
448 static function &fieldKeys() {
bd8e0b14
TO
449 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
450 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
e501603b 451 }
bd8e0b14 452 return Civi::$statics[__CLASS__]['fieldKeys'];
e501603b
TO
453 }
454 /**
455 * Returns the names of this table
456 *
457 * @return string
458 */
459 static function getTableName() {
460 return CRM_Core_DAO::getLocaleTableName(self::$_tableName);
461 }
462 /**
463 * Returns if this table needs to be logged
464 *
465 * @return boolean
466 */
467 function getLog() {
468 return self::$_log;
469 }
470 /**
471 * Returns the list of fields that can be imported
472 *
473 * @param bool $prefix
474 *
475 * @return array
476 */
477 static function &import($prefix = false) {
60808919
TO
478 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'price_field_value', $prefix, array());
479 return $r;
e501603b
TO
480 }
481 /**
482 * Returns the list of fields that can be exported
483 *
484 * @param bool $prefix
485 *
486 * @return array
487 */
488 static function &export($prefix = false) {
60808919
TO
489 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'price_field_value', $prefix, array());
490 return $r;
e501603b
TO
491 }
492}