5 * @copyright CiviCRM LLC https://civicrm.org/licensing
7 * Generated from xml/schema/CRM/Contribute/Premium.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:cd1826e777cea80450636ef175aaab7f)
13 * Database access object for the Premium entity.
15 class CRM_Contribute_DAO_Premium
extends CRM_Core_DAO
{
16 const EXT
= 'civicrm';
17 const TABLE_ADDED
= '1.4';
20 * Static instance to hold the table name.
24 public static $_tableName = 'civicrm_premiums';
27 * Should CiviCRM log any modifications to this table in the civicrm_log table.
31 public static $_log = TRUE;
39 * Joins these premium settings to another object. Always civicrm_contribution_page for now.
51 * Is the Premiums feature enabled for this page?
55 public $premiums_active;
58 * Title for Premiums section.
62 public $premiums_intro_title;
65 * Displayed in <div> at top of Premiums section of page. Text and HTML allowed.
69 public $premiums_intro_text;
72 * This email address is included in receipts if it is populated and a premium has been selected.
76 public $premiums_contact_email;
79 * This phone number is included in receipts if it is populated and a premium has been selected.
83 public $premiums_contact_phone;
86 * Boolean. Should we automatically display minimum contribution amount text after the premium descriptions.
90 public $premiums_display_min_contribution;
93 * Label displayed for No Thank-you option in premiums block (e.g. No thank you)
97 public $premiums_nothankyou_label;
102 public $premiums_nothankyou_position;
107 public function __construct() {
108 $this->__table
= 'civicrm_premiums';
109 parent
::__construct();
113 * Returns localized title of this entity.
115 public static function getEntityTitle() {
116 return ts('Premiums');
120 * Returns foreign keys and entity references.
123 * [CRM_Core_Reference_Interface]
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']);
131 return Civi
::$statics[__CLASS__
]['links'];
135 * Returns all the column names of this table
139 public static function &fields() {
140 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
141 Civi
::$statics[__CLASS__
]['fields'] = [
144 'type' => CRM_Utils_Type
::T_INT
,
145 'title' => ts('Premium ID'),
147 'where' => 'civicrm_premiums.id',
148 'table_name' => 'civicrm_premiums',
149 'entity' => 'Premium',
150 'bao' => 'CRM_Contribute_BAO_Premium',
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.'),
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',
170 'name' => 'entity_id',
171 'type' => CRM_Utils_Type
::T_INT
,
172 'title' => ts('Premium entity ID'),
174 'where' => 'civicrm_premiums.entity_id',
175 'table_name' => 'civicrm_premiums',
176 'entity' => 'Premium',
177 'bao' => 'CRM_Contribute_BAO_Premium',
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?'),
187 'where' => 'civicrm_premiums.premiums_active',
189 'table_name' => 'civicrm_premiums',
190 'entity' => 'Premium',
191 'bao' => 'CRM_Contribute_BAO_Premium',
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.'),
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',
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',
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.'),
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',
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.'),
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',
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.'),
255 'where' => 'civicrm_premiums.premiums_display_min_contribution',
256 'table_name' => 'civicrm_premiums',
257 'entity' => 'Premium',
258 'bao' => 'CRM_Contribute_BAO_Premium',
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)'),
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',
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',
282 'table_name' => 'civicrm_premiums',
283 'entity' => 'Premium',
284 'bao' => 'CRM_Contribute_BAO_Premium',
289 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
291 return Civi
::$statics[__CLASS__
]['fields'];
295 * Return a mapping from field-name to the corresponding key (as used in fields()).
298 * Array(string $name => string $uniqueName).
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()));
304 return Civi
::$statics[__CLASS__
]['fieldKeys'];
308 * Returns the names of this table
312 public static function getTableName() {
313 return CRM_Core_DAO
::getLocaleTableName(self
::$_tableName);
317 * Returns if this table needs to be logged
321 public function getLog() {
326 * Returns the list of fields that can be imported
328 * @param bool $prefix
332 public static function &import($prefix = FALSE) {
333 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'premiums', $prefix, []);
338 * Returns the list of fields that can be exported
340 * @param bool $prefix
344 public static function &export($prefix = FALSE) {
345 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'premiums', $prefix, []);
350 * Returns the list of indices
352 * @param bool $localize
356 public static function indices($localize = TRUE) {
358 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;