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