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