API/DAO Metadata - Retain versioning metadata for possible usage in runtime+tooling
[civicrm-core.git] / CRM / Contribute / DAO / Premium.php
1 <?php
2
3 /**
4 * @package CRM
5 * @copyright CiviCRM LLC https://civicrm.org/licensing
6 *
7 * Generated from xml/schema/CRM/Contribute/Premium.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:df0bfae4e0916c02a621471db14f3151)
10 */
11
12 /**
13 * Database access object for the Premium entity.
14 */
15 class CRM_Contribute_DAO_Premium extends CRM_Core_DAO {
16
17 /**
18 * Static instance to hold the table name.
19 *
20 * @var string
21 */
22 public static $_tableName = 'civicrm_premiums';
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 = TRUE;
30
31 /**
32 * @var int
33 */
34 public $id;
35
36 /**
37 * Joins these premium settings to another object. Always civicrm_contribution_page for now.
38 *
39 * @var string
40 */
41 public $entity_table;
42
43 /**
44 * @var int
45 */
46 public $entity_id;
47
48 /**
49 * Is the Premiums feature enabled for this page?
50 *
51 * @var bool
52 */
53 public $premiums_active;
54
55 /**
56 * Title for Premiums section.
57 *
58 * @var string
59 */
60 public $premiums_intro_title;
61
62 /**
63 * Displayed in <div> at top of Premiums section of page. Text and HTML allowed.
64 *
65 * @var text
66 */
67 public $premiums_intro_text;
68
69 /**
70 * This email address is included in receipts if it is populated and a premium has been selected.
71 *
72 * @var string
73 */
74 public $premiums_contact_email;
75
76 /**
77 * This phone number is included in receipts if it is populated and a premium has been selected.
78 *
79 * @var string
80 */
81 public $premiums_contact_phone;
82
83 /**
84 * Boolean. Should we automatically display minimum contribution amount text after the premium descriptions.
85 *
86 * @var bool
87 */
88 public $premiums_display_min_contribution;
89
90 /**
91 * Label displayed for No Thank-you option in premiums block (e.g. No thank you)
92 *
93 * @var string
94 */
95 public $premiums_nothankyou_label;
96
97 /**
98 * @var int
99 */
100 public $premiums_nothankyou_position;
101
102 /**
103 * Class constructor.
104 */
105 public function __construct() {
106 $this->__table = 'civicrm_premiums';
107 parent::__construct();
108 }
109
110 /**
111 * Returns localized title of this entity.
112 */
113 public static function getEntityTitle() {
114 return ts('Premiums');
115 }
116
117 /**
118 * Returns foreign keys and entity references.
119 *
120 * @return array
121 * [CRM_Core_Reference_Interface]
122 */
123 public static function getReferenceColumns() {
124 if (!isset(Civi::$statics[__CLASS__]['links'])) {
125 Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__);
126 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Dynamic(self::getTableName(), 'entity_id', NULL, 'id', 'entity_table');
127 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
128 }
129 return Civi::$statics[__CLASS__]['links'];
130 }
131
132 /**
133 * Returns all the column names of this table
134 *
135 * @return array
136 */
137 public static function &fields() {
138 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
139 Civi::$statics[__CLASS__]['fields'] = [
140 'id' => [
141 'name' => 'id',
142 'type' => CRM_Utils_Type::T_INT,
143 'title' => ts('Premium ID'),
144 'required' => TRUE,
145 'where' => 'civicrm_premiums.id',
146 'table_name' => 'civicrm_premiums',
147 'entity' => 'Premium',
148 'bao' => 'CRM_Contribute_BAO_Premium',
149 'localizable' => 0,
150 'add' => '1.4',
151 ],
152 'entity_table' => [
153 'name' => 'entity_table',
154 'type' => CRM_Utils_Type::T_STRING,
155 'title' => ts('Premium Entity'),
156 'description' => ts('Joins these premium settings to another object. Always civicrm_contribution_page for now.'),
157 'required' => TRUE,
158 'maxlength' => 64,
159 'size' => CRM_Utils_Type::BIG,
160 'where' => 'civicrm_premiums.entity_table',
161 'table_name' => 'civicrm_premiums',
162 'entity' => 'Premium',
163 'bao' => 'CRM_Contribute_BAO_Premium',
164 'localizable' => 0,
165 'add' => '1.4',
166 ],
167 'entity_id' => [
168 'name' => 'entity_id',
169 'type' => CRM_Utils_Type::T_INT,
170 'title' => ts('Premium entity ID'),
171 'required' => TRUE,
172 'where' => 'civicrm_premiums.entity_id',
173 'table_name' => 'civicrm_premiums',
174 'entity' => 'Premium',
175 'bao' => 'CRM_Contribute_BAO_Premium',
176 'localizable' => 0,
177 'add' => '1.4',
178 ],
179 'premiums_active' => [
180 'name' => 'premiums_active',
181 'type' => CRM_Utils_Type::T_BOOLEAN,
182 'title' => ts('Is Premium Active?'),
183 'description' => ts('Is the Premiums feature enabled for this page?'),
184 'required' => TRUE,
185 'where' => 'civicrm_premiums.premiums_active',
186 'default' => '0',
187 'table_name' => 'civicrm_premiums',
188 'entity' => 'Premium',
189 'bao' => 'CRM_Contribute_BAO_Premium',
190 'localizable' => 0,
191 'add' => '1.4',
192 ],
193 'premiums_intro_title' => [
194 'name' => 'premiums_intro_title',
195 'type' => CRM_Utils_Type::T_STRING,
196 'title' => ts('Title for Premiums section'),
197 'description' => ts('Title for Premiums section.'),
198 'maxlength' => 255,
199 'size' => CRM_Utils_Type::HUGE,
200 'where' => 'civicrm_premiums.premiums_intro_title',
201 'table_name' => 'civicrm_premiums',
202 'entity' => 'Premium',
203 'bao' => 'CRM_Contribute_BAO_Premium',
204 'localizable' => 1,
205 'add' => '1.4',
206 ],
207 'premiums_intro_text' => [
208 'name' => 'premiums_intro_text',
209 'type' => CRM_Utils_Type::T_TEXT,
210 'title' => ts('Premium Introductory Text'),
211 'description' => ts('Displayed in <div> at top of Premiums section of page. Text and HTML allowed.'),
212 'where' => 'civicrm_premiums.premiums_intro_text',
213 'table_name' => 'civicrm_premiums',
214 'entity' => 'Premium',
215 'bao' => 'CRM_Contribute_BAO_Premium',
216 'localizable' => 1,
217 'add' => '1.4',
218 ],
219 'premiums_contact_email' => [
220 'name' => 'premiums_contact_email',
221 'type' => CRM_Utils_Type::T_STRING,
222 'title' => ts('Premium Contact Email'),
223 'description' => ts('This email address is included in receipts if it is populated and a premium has been selected.'),
224 'maxlength' => 100,
225 'size' => CRM_Utils_Type::HUGE,
226 'where' => 'civicrm_premiums.premiums_contact_email',
227 'table_name' => 'civicrm_premiums',
228 'entity' => 'Premium',
229 'bao' => 'CRM_Contribute_BAO_Premium',
230 'localizable' => 0,
231 'add' => '1.4',
232 ],
233 'premiums_contact_phone' => [
234 'name' => 'premiums_contact_phone',
235 'type' => CRM_Utils_Type::T_STRING,
236 'title' => ts('Premiums Contact Phone'),
237 'description' => ts('This phone number is included in receipts if it is populated and a premium has been selected.'),
238 'maxlength' => 50,
239 'size' => CRM_Utils_Type::BIG,
240 'where' => 'civicrm_premiums.premiums_contact_phone',
241 'table_name' => 'civicrm_premiums',
242 'entity' => 'Premium',
243 'bao' => 'CRM_Contribute_BAO_Premium',
244 'localizable' => 0,
245 'add' => '1.4',
246 ],
247 'premiums_display_min_contribution' => [
248 'name' => 'premiums_display_min_contribution',
249 'type' => CRM_Utils_Type::T_BOOLEAN,
250 'title' => ts('Display Minimum Contribution?'),
251 'description' => ts('Boolean. Should we automatically display minimum contribution amount text after the premium descriptions.'),
252 'required' => TRUE,
253 'where' => 'civicrm_premiums.premiums_display_min_contribution',
254 'table_name' => 'civicrm_premiums',
255 'entity' => 'Premium',
256 'bao' => 'CRM_Contribute_BAO_Premium',
257 'localizable' => 0,
258 'add' => '1.4',
259 ],
260 'premiums_nothankyou_label' => [
261 'name' => 'premiums_nothankyou_label',
262 'type' => CRM_Utils_Type::T_STRING,
263 'title' => ts('No Thank-you Text'),
264 'description' => ts('Label displayed for No Thank-you option in premiums block (e.g. No thank you)'),
265 'maxlength' => 255,
266 'size' => CRM_Utils_Type::HUGE,
267 'where' => 'civicrm_premiums.premiums_nothankyou_label',
268 'table_name' => 'civicrm_premiums',
269 'entity' => 'Premium',
270 'bao' => 'CRM_Contribute_BAO_Premium',
271 'localizable' => 1,
272 'add' => '4.3',
273 ],
274 'premiums_nothankyou_position' => [
275 'name' => 'premiums_nothankyou_position',
276 'type' => CRM_Utils_Type::T_INT,
277 'title' => ts('No Thank-you Position'),
278 'where' => 'civicrm_premiums.premiums_nothankyou_position',
279 'default' => '1',
280 'table_name' => 'civicrm_premiums',
281 'entity' => 'Premium',
282 'bao' => 'CRM_Contribute_BAO_Premium',
283 'localizable' => 0,
284 'add' => '4.3',
285 ],
286 ];
287 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
288 }
289 return Civi::$statics[__CLASS__]['fields'];
290 }
291
292 /**
293 * Return a mapping from field-name to the corresponding key (as used in fields()).
294 *
295 * @return array
296 * Array(string $name => string $uniqueName).
297 */
298 public static function &fieldKeys() {
299 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
300 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
301 }
302 return Civi::$statics[__CLASS__]['fieldKeys'];
303 }
304
305 /**
306 * Returns the names of this table
307 *
308 * @return string
309 */
310 public static function getTableName() {
311 return CRM_Core_DAO::getLocaleTableName(self::$_tableName);
312 }
313
314 /**
315 * Returns if this table needs to be logged
316 *
317 * @return bool
318 */
319 public function getLog() {
320 return self::$_log;
321 }
322
323 /**
324 * Returns the list of fields that can be imported
325 *
326 * @param bool $prefix
327 *
328 * @return array
329 */
330 public static function &import($prefix = FALSE) {
331 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'premiums', $prefix, []);
332 return $r;
333 }
334
335 /**
336 * Returns the list of fields that can be exported
337 *
338 * @param bool $prefix
339 *
340 * @return array
341 */
342 public static function &export($prefix = FALSE) {
343 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'premiums', $prefix, []);
344 return $r;
345 }
346
347 /**
348 * Returns the list of indices
349 *
350 * @param bool $localize
351 *
352 * @return array
353 */
354 public static function indices($localize = TRUE) {
355 $indices = [];
356 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
357 }
358
359 }