Regen DAOs with new fieldKeys()
[civicrm-core.git] / CRM / Price / DAO / PriceFieldValue.php
CommitLineData
e501603b
TO
1<?php
2/*
3+--------------------------------------------------------------------+
4| CiviCRM version 4.7 |
5+--------------------------------------------------------------------+
6| Copyright CiviCRM LLC (c) 2004-2016 |
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
29 * @copyright CiviCRM LLC (c) 2004-2016
30 *
31 * Generated from xml/schema/CRM/Price/PriceFieldValue.xml
32 * DO NOT EDIT. Generated by CRM_Core_CodeGen
437fafcf 33 * (GenCodeChecksum:14d1591a915f160a115553bc53439d1a)
e501603b
TO
34 */
35require_once 'CRM/Core/DAO.php';
36require_once 'CRM/Utils/Type.php';
37class CRM_Price_DAO_PriceFieldValue extends CRM_Core_DAO {
38 /**
39 * static instance to hold the table name
40 *
41 * @var string
42 */
43 static $_tableName = 'civicrm_price_field_value';
44 /**
45 * static instance to hold the field values
46 *
47 * @var array
48 */
49 static $_fields = null;
e501603b
TO
50 /**
51 * static instance to hold the FK relationships
52 *
53 * @var string
54 */
55 static $_links = null;
e501603b
TO
56 /**
57 * static value to see if we should log any modifications to
58 * this table in the civicrm_log table
59 *
60 * @var boolean
61 */
62 static $_log = false;
63 /**
64 * Price Field Value
65 *
66 * @var int unsigned
67 */
68 public $id;
69 /**
70 * FK to civicrm_price_field
71 *
72 * @var int unsigned
73 */
74 public $price_field_id;
75 /**
76 * Price field option name
77 *
78 * @var string
79 */
80 public $name;
81 /**
82 * Price field option label
83 *
84 * @var string
85 */
86 public $label;
87 /**
88 * >Price field option description.
89 *
90 * @var text
91 */
92 public $description;
93 /**
94 * Price field option pre help text.
95 *
96 * @var text
97 */
98 public $help_pre;
99 /**
100 * Price field option post field help.
101 *
102 * @var text
103 */
104 public $help_post;
105 /**
106 * Price field option amount
107 *
108 * @var string
109 */
110 public $amount;
111 /**
112 * Number of participants per field option
113 *
114 * @var int unsigned
115 */
116 public $count;
117 /**
118 * Max number of participants per field options
119 *
120 * @var int unsigned
121 */
122 public $max_value;
123 /**
124 * Order in which the field options should appear
125 *
126 * @var int
127 */
128 public $weight;
129 /**
130 * FK to Membership Type
131 *
132 * @var int unsigned
133 */
134 public $membership_type_id;
135 /**
136 * Number of terms for this membership
137 *
138 * @var int unsigned
139 */
140 public $membership_num_terms;
141 /**
142 * Is this default price field option
143 *
144 * @var boolean
145 */
146 public $is_default;
147 /**
148 * Is this price field value active
149 *
150 * @var boolean
151 */
152 public $is_active;
153 /**
154 * FK to Financial Type.
155 *
156 * @var int unsigned
157 */
158 public $financial_type_id;
159 /**
160 * Tax-deductible portion of the amount
161 *
162 * @var float
163 */
164 public $deductible_amount;
165 /**
166 * class constructor
167 *
168 * @return civicrm_price_field_value
169 */
170 function __construct() {
171 $this->__table = 'civicrm_price_field_value';
172 parent::__construct();
173 }
174 /**
175 * Returns foreign keys and entity references
176 *
177 * @return array
178 * [CRM_Core_Reference_Interface]
179 */
180 static function getReferenceColumns() {
181 if (!self::$_links) {
182 self::$_links = static ::createReferenceColumns(__CLASS__);
183 self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'price_field_id', 'civicrm_price_field', 'id');
184 self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'membership_type_id', 'civicrm_membership_type', 'id');
185 self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'financial_type_id', 'civicrm_financial_type', 'id');
186 }
187 return self::$_links;
188 }
189 /**
190 * Returns all the column names of this table
191 *
192 * @return array
193 */
194 static function &fields() {
195 if (!(self::$_fields)) {
196 self::$_fields = array(
197 'id' => array(
198 'name' => 'id',
199 'type' => CRM_Utils_Type::T_INT,
200 'title' => ts('Price Field Value ID') ,
201 'description' => 'Price Field Value',
202 'required' => true,
203 ) ,
204 'price_field_id' => array(
205 'name' => 'price_field_id',
206 'type' => CRM_Utils_Type::T_INT,
207 'title' => ts('Price Field') ,
208 'description' => 'FK to civicrm_price_field',
209 'required' => true,
210 'FKClassName' => 'CRM_Price_DAO_PriceField',
211 ) ,
212 'name' => array(
213 'name' => 'name',
214 'type' => CRM_Utils_Type::T_STRING,
215 'title' => ts('Name') ,
216 'description' => 'Price field option name',
217 'maxlength' => 255,
218 'size' => CRM_Utils_Type::HUGE,
219 'html' => array(
220 'type' => 'Text',
221 ) ,
222 ) ,
223 'label' => array(
224 'name' => 'label',
225 'type' => CRM_Utils_Type::T_STRING,
226 'title' => ts('Label') ,
227 'description' => 'Price field option label',
228 'maxlength' => 255,
229 'size' => CRM_Utils_Type::HUGE,
230 'html' => array(
231 'type' => 'Text',
232 ) ,
233 ) ,
234 'description' => array(
235 'name' => 'description',
236 'type' => CRM_Utils_Type::T_TEXT,
237 'title' => ts('Description') ,
238 'description' => '>Price field option description.',
239 'rows' => 2,
240 'cols' => 60,
241 'default' => 'NULL',
242 'html' => array(
243 'type' => 'TextArea',
244 ) ,
245 ) ,
246 'help_pre' => array(
247 'name' => 'help_pre',
248 'type' => CRM_Utils_Type::T_TEXT,
249 'title' => ts('Help Pre') ,
250 'description' => 'Price field option pre help text.',
251 'rows' => 2,
252 'cols' => 60,
253 'default' => 'NULL',
254 'html' => array(
255 'type' => 'TextArea',
256 ) ,
257 ) ,
258 'help_post' => array(
259 'name' => 'help_post',
260 'type' => CRM_Utils_Type::T_TEXT,
261 'title' => ts('Help Post') ,
262 'description' => 'Price field option post field help.',
263 'rows' => 2,
264 'cols' => 60,
265 'default' => 'NULL',
266 'html' => array(
267 'type' => 'TextArea',
268 ) ,
269 ) ,
270 'amount' => array(
271 'name' => 'amount',
272 'type' => CRM_Utils_Type::T_STRING,
273 'title' => ts('Amount') ,
274 'description' => 'Price field option amount',
275 'required' => true,
276 'maxlength' => 512,
277 'size' => 8,
278 'html' => array(
279 'type' => 'Text',
280 ) ,
281 ) ,
282 'count' => array(
283 'name' => 'count',
284 'type' => CRM_Utils_Type::T_INT,
285 'title' => ts('Count') ,
286 'description' => 'Number of participants per field option',
287 'default' => 'NULL',
288 'html' => array(
289 'type' => 'Text',
290 ) ,
291 ) ,
292 'max_value' => array(
293 'name' => 'max_value',
294 'type' => CRM_Utils_Type::T_INT,
295 'title' => ts('Max Value') ,
296 'description' => 'Max number of participants per field options',
297 'default' => 'NULL',
298 'html' => array(
299 'type' => 'Text',
300 ) ,
301 ) ,
302 'weight' => array(
303 'name' => 'weight',
304 'type' => CRM_Utils_Type::T_INT,
305 'title' => ts('Order') ,
306 'description' => 'Order in which the field options should appear',
307 'default' => '1',
308 'html' => array(
309 'type' => 'Text',
310 ) ,
311 ) ,
312 'membership_type_id' => array(
313 'name' => 'membership_type_id',
314 'type' => CRM_Utils_Type::T_INT,
315 'title' => ts('Membership Type') ,
316 'description' => 'FK to Membership Type',
317 'default' => 'NULL',
318 'FKClassName' => 'CRM_Member_DAO_MembershipType',
319 'html' => array(
320 'type' => 'Select',
321 ) ,
322 ) ,
323 'membership_num_terms' => array(
324 'name' => 'membership_num_terms',
325 'type' => CRM_Utils_Type::T_INT,
326 'title' => ts('Membership Num Terms') ,
327 'description' => 'Number of terms for this membership',
328 'default' => 'NULL',
329 'html' => array(
330 'type' => 'Text',
331 ) ,
332 ) ,
333 'is_default' => array(
334 'name' => 'is_default',
335 'type' => CRM_Utils_Type::T_BOOLEAN,
336 'title' => ts('Is Default Price Field Option?') ,
337 'description' => 'Is this default price field option',
338 'html' => array(
339 'type' => 'CheckBox',
340 ) ,
341 ) ,
342 'is_active' => array(
343 'name' => 'is_active',
344 'type' => CRM_Utils_Type::T_BOOLEAN,
345 'title' => ts('Price Field Value is Active') ,
346 'description' => 'Is this price field value active',
347 'default' => '1',
348 ) ,
349 'financial_type_id' => array(
350 'name' => 'financial_type_id',
351 'type' => CRM_Utils_Type::T_INT,
352 'title' => ts('Financial Type') ,
353 'description' => 'FK to Financial Type.',
354 'default' => 'NULL',
355 'FKClassName' => 'CRM_Financial_DAO_FinancialType',
356 'html' => array(
357 'type' => 'Select',
358 ) ,
359 'pseudoconstant' => array(
360 'table' => 'civicrm_financial_type',
361 'keyColumn' => 'id',
362 'labelColumn' => 'name',
363 )
364 ) ,
365 'deductible_amount' => array(
366 'name' => 'deductible_amount',
367 'type' => CRM_Utils_Type::T_MONEY,
368 'title' => ts('Deductible Amount') ,
369 'description' => 'Tax-deductible portion of the amount',
370 'required' => true,
371 'precision' => array(
372 20,
373 2
374 ) ,
375 'default' => '0.0',
376 'html' => array(
377 'type' => 'Text',
378 ) ,
379 ) ,
380 );
381 }
382 return self::$_fields;
383 }
384 /**
bd8e0b14 385 * Return a mapping from field-name to the corresponding key (as used in fields()).
e501603b
TO
386 *
387 * @return array
bd8e0b14 388 * Array(string $name => string $uniqueName).
e501603b
TO
389 */
390 static function &fieldKeys() {
bd8e0b14
TO
391 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
392 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
e501603b 393 }
bd8e0b14 394 return Civi::$statics[__CLASS__]['fieldKeys'];
e501603b
TO
395 }
396 /**
397 * Returns the names of this table
398 *
399 * @return string
400 */
401 static function getTableName() {
402 return CRM_Core_DAO::getLocaleTableName(self::$_tableName);
403 }
404 /**
405 * Returns if this table needs to be logged
406 *
407 * @return boolean
408 */
409 function getLog() {
410 return self::$_log;
411 }
412 /**
413 * Returns the list of fields that can be imported
414 *
415 * @param bool $prefix
416 *
417 * @return array
418 */
419 static function &import($prefix = false) {
60808919
TO
420 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'price_field_value', $prefix, array());
421 return $r;
e501603b
TO
422 }
423 /**
424 * Returns the list of fields that can be exported
425 *
426 * @param bool $prefix
427 *
428 * @return array
429 */
430 static function &export($prefix = false) {
60808919
TO
431 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'price_field_value', $prefix, array());
432 return $r;
e501603b
TO
433 }
434}