5 * @copyright CiviCRM LLC (c) 2004-2019
7 * Generated from xml/schema/CRM/Contribute/Premium.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:10cc32dfc45ec3853caebce2d5b78018)
13 * Database access object for the Premium entity.
15 class CRM_Contribute_DAO_Premium
extends CRM_Core_DAO
{
18 * Static instance to hold the table name.
22 public static $_tableName = 'civicrm_premiums';
25 * Should CiviCRM log any modifications to this table in the civicrm_log table.
29 public static $_log = TRUE;
37 * Joins these premium settings to another object. Always civicrm_contribution_page for now.
49 * Is the Premiums feature enabled for this page?
53 public $premiums_active;
56 * Title for Premiums section.
60 public $premiums_intro_title;
63 * Displayed in <div> at top of Premiums section of page. Text and HTML allowed.
67 public $premiums_intro_text;
70 * This email address is included in receipts if it is populated and a premium has been selected.
74 public $premiums_contact_email;
77 * This phone number is included in receipts if it is populated and a premium has been selected.
81 public $premiums_contact_phone;
84 * Boolean. Should we automatically display minimum contribution amount text after the premium descriptions.
88 public $premiums_display_min_contribution;
91 * Label displayed for No Thank-you option in premiums block (e.g. No thank you)
95 public $premiums_nothankyou_label;
100 public $premiums_nothankyou_position;
105 public function __construct() {
106 $this->__table
= 'civicrm_premiums';
107 parent
::__construct();
111 * Returns foreign keys and entity references.
114 * [CRM_Core_Reference_Interface]
116 public static function getReferenceColumns() {
117 if (!isset(Civi
::$statics[__CLASS__
]['links'])) {
118 Civi
::$statics[__CLASS__
]['links'] = static::createReferenceColumns(__CLASS__
);
119 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Dynamic(self
::getTableName(), 'entity_id', NULL, 'id', 'entity_table');
120 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'links_callback', Civi
::$statics[__CLASS__
]['links']);
122 return Civi
::$statics[__CLASS__
]['links'];
126 * Returns all the column names of this table
130 public static function &fields() {
131 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
132 Civi
::$statics[__CLASS__
]['fields'] = [
135 'type' => CRM_Utils_Type
::T_INT
,
136 'title' => ts('Premium ID'),
138 'where' => 'civicrm_premiums.id',
139 'table_name' => 'civicrm_premiums',
140 'entity' => 'Premium',
141 'bao' => 'CRM_Contribute_BAO_Premium',
145 'name' => 'entity_table',
146 'type' => CRM_Utils_Type
::T_STRING
,
147 'title' => ts('Premium Entity'),
148 'description' => ts('Joins these premium settings to another object. Always civicrm_contribution_page for now.'),
151 'size' => CRM_Utils_Type
::BIG
,
152 'where' => 'civicrm_premiums.entity_table',
153 'table_name' => 'civicrm_premiums',
154 'entity' => 'Premium',
155 'bao' => 'CRM_Contribute_BAO_Premium',
159 'name' => 'entity_id',
160 'type' => CRM_Utils_Type
::T_INT
,
161 'title' => ts('Premium entity ID'),
163 'where' => 'civicrm_premiums.entity_id',
164 'table_name' => 'civicrm_premiums',
165 'entity' => 'Premium',
166 'bao' => 'CRM_Contribute_BAO_Premium',
169 'premiums_active' => [
170 'name' => 'premiums_active',
171 'type' => CRM_Utils_Type
::T_BOOLEAN
,
172 'title' => ts('Is Premium Active?'),
173 'description' => ts('Is the Premiums feature enabled for this page?'),
175 'where' => 'civicrm_premiums.premiums_active',
177 'table_name' => 'civicrm_premiums',
178 'entity' => 'Premium',
179 'bao' => 'CRM_Contribute_BAO_Premium',
182 'premiums_intro_title' => [
183 'name' => 'premiums_intro_title',
184 'type' => CRM_Utils_Type
::T_STRING
,
185 'title' => ts('Title for Premiums section'),
186 'description' => ts('Title for Premiums section.'),
188 'size' => CRM_Utils_Type
::HUGE
,
189 'where' => 'civicrm_premiums.premiums_intro_title',
190 'table_name' => 'civicrm_premiums',
191 'entity' => 'Premium',
192 'bao' => 'CRM_Contribute_BAO_Premium',
195 'premiums_intro_text' => [
196 'name' => 'premiums_intro_text',
197 'type' => CRM_Utils_Type
::T_TEXT
,
198 'title' => ts('Premium Introductory Text'),
199 'description' => ts('Displayed in <div> at top of Premiums section of page. Text and HTML allowed.'),
200 'where' => 'civicrm_premiums.premiums_intro_text',
201 'table_name' => 'civicrm_premiums',
202 'entity' => 'Premium',
203 'bao' => 'CRM_Contribute_BAO_Premium',
206 'premiums_contact_email' => [
207 'name' => 'premiums_contact_email',
208 'type' => CRM_Utils_Type
::T_STRING
,
209 'title' => ts('Premium Contact Email'),
210 'description' => ts('This email address is included in receipts if it is populated and a premium has been selected.'),
212 'size' => CRM_Utils_Type
::HUGE
,
213 'where' => 'civicrm_premiums.premiums_contact_email',
214 'table_name' => 'civicrm_premiums',
215 'entity' => 'Premium',
216 'bao' => 'CRM_Contribute_BAO_Premium',
219 'premiums_contact_phone' => [
220 'name' => 'premiums_contact_phone',
221 'type' => CRM_Utils_Type
::T_STRING
,
222 'title' => ts('Premiums Contact Phone'),
223 'description' => ts('This phone number is included in receipts if it is populated and a premium has been selected.'),
225 'size' => CRM_Utils_Type
::BIG
,
226 'where' => 'civicrm_premiums.premiums_contact_phone',
227 'table_name' => 'civicrm_premiums',
228 'entity' => 'Premium',
229 'bao' => 'CRM_Contribute_BAO_Premium',
232 'premiums_display_min_contribution' => [
233 'name' => 'premiums_display_min_contribution',
234 'type' => CRM_Utils_Type
::T_BOOLEAN
,
235 'title' => ts('Display Minimum Contribution?'),
236 'description' => ts('Boolean. Should we automatically display minimum contribution amount text after the premium descriptions.'),
238 'where' => 'civicrm_premiums.premiums_display_min_contribution',
239 'table_name' => 'civicrm_premiums',
240 'entity' => 'Premium',
241 'bao' => 'CRM_Contribute_BAO_Premium',
244 'premiums_nothankyou_label' => [
245 'name' => 'premiums_nothankyou_label',
246 'type' => CRM_Utils_Type
::T_STRING
,
247 'title' => ts('No Thank-you Text'),
248 'description' => ts('Label displayed for No Thank-you option in premiums block (e.g. No thank you)'),
250 'size' => CRM_Utils_Type
::HUGE
,
251 'where' => 'civicrm_premiums.premiums_nothankyou_label',
252 'table_name' => 'civicrm_premiums',
253 'entity' => 'Premium',
254 'bao' => 'CRM_Contribute_BAO_Premium',
257 'premiums_nothankyou_position' => [
258 'name' => 'premiums_nothankyou_position',
259 'type' => CRM_Utils_Type
::T_INT
,
260 'title' => ts('No Thank-you Position'),
261 'where' => 'civicrm_premiums.premiums_nothankyou_position',
263 'table_name' => 'civicrm_premiums',
264 'entity' => 'Premium',
265 'bao' => 'CRM_Contribute_BAO_Premium',
269 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
271 return Civi
::$statics[__CLASS__
]['fields'];
275 * Return a mapping from field-name to the corresponding key (as used in fields()).
278 * Array(string $name => string $uniqueName).
280 public static function &fieldKeys() {
281 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
282 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
284 return Civi
::$statics[__CLASS__
]['fieldKeys'];
288 * Returns the names of this table
292 public static function getTableName() {
293 return CRM_Core_DAO
::getLocaleTableName(self
::$_tableName);
297 * Returns if this table needs to be logged
301 public function getLog() {
306 * Returns the list of fields that can be imported
308 * @param bool $prefix
312 public static function &import($prefix = FALSE) {
313 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'premiums', $prefix, []);
318 * Returns the list of fields that can be exported
320 * @param bool $prefix
324 public static function &export($prefix = FALSE) {
325 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'premiums', $prefix, []);
330 * Returns the list of indices
332 * @param bool $localize
336 public static function indices($localize = TRUE) {
338 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;