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:62ca558719cfe842066d2fb208df2f76)
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 localized title of this entity.
113 public static function getEntityTitle() {
114 return ts('Premiums');
118 * Returns foreign keys and entity references.
121 * [CRM_Core_Reference_Interface]
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']);
129 return Civi
::$statics[__CLASS__
]['links'];
133 * Returns all the column names of this table
137 public static function &fields() {
138 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
139 Civi
::$statics[__CLASS__
]['fields'] = [
142 'type' => CRM_Utils_Type
::T_INT
,
143 'title' => ts('Premium ID'),
145 'where' => 'civicrm_premiums.id',
146 'table_name' => 'civicrm_premiums',
147 'entity' => 'Premium',
148 'bao' => 'CRM_Contribute_BAO_Premium',
152 'name' => 'entity_table',
153 'type' => CRM_Utils_Type
::T_STRING
,
154 'title' => ts('Premium Entity'),
155 'description' => ts('Joins these premium settings to another object. Always civicrm_contribution_page for now.'),
158 'size' => CRM_Utils_Type
::BIG
,
159 'where' => 'civicrm_premiums.entity_table',
160 'table_name' => 'civicrm_premiums',
161 'entity' => 'Premium',
162 'bao' => 'CRM_Contribute_BAO_Premium',
166 'name' => 'entity_id',
167 'type' => CRM_Utils_Type
::T_INT
,
168 'title' => ts('Premium entity ID'),
170 'where' => 'civicrm_premiums.entity_id',
171 'table_name' => 'civicrm_premiums',
172 'entity' => 'Premium',
173 'bao' => 'CRM_Contribute_BAO_Premium',
176 'premiums_active' => [
177 'name' => 'premiums_active',
178 'type' => CRM_Utils_Type
::T_BOOLEAN
,
179 'title' => ts('Is Premium Active?'),
180 'description' => ts('Is the Premiums feature enabled for this page?'),
182 'where' => 'civicrm_premiums.premiums_active',
184 'table_name' => 'civicrm_premiums',
185 'entity' => 'Premium',
186 'bao' => 'CRM_Contribute_BAO_Premium',
189 'premiums_intro_title' => [
190 'name' => 'premiums_intro_title',
191 'type' => CRM_Utils_Type
::T_STRING
,
192 'title' => ts('Title for Premiums section'),
193 'description' => ts('Title for Premiums section.'),
195 'size' => CRM_Utils_Type
::HUGE
,
196 'where' => 'civicrm_premiums.premiums_intro_title',
197 'table_name' => 'civicrm_premiums',
198 'entity' => 'Premium',
199 'bao' => 'CRM_Contribute_BAO_Premium',
202 'premiums_intro_text' => [
203 'name' => 'premiums_intro_text',
204 'type' => CRM_Utils_Type
::T_TEXT
,
205 'title' => ts('Premium Introductory Text'),
206 'description' => ts('Displayed in <div> at top of Premiums section of page. Text and HTML allowed.'),
207 'where' => 'civicrm_premiums.premiums_intro_text',
208 'table_name' => 'civicrm_premiums',
209 'entity' => 'Premium',
210 'bao' => 'CRM_Contribute_BAO_Premium',
213 'premiums_contact_email' => [
214 'name' => 'premiums_contact_email',
215 'type' => CRM_Utils_Type
::T_STRING
,
216 'title' => ts('Premium Contact Email'),
217 'description' => ts('This email address is included in receipts if it is populated and a premium has been selected.'),
219 'size' => CRM_Utils_Type
::HUGE
,
220 'where' => 'civicrm_premiums.premiums_contact_email',
221 'table_name' => 'civicrm_premiums',
222 'entity' => 'Premium',
223 'bao' => 'CRM_Contribute_BAO_Premium',
226 'premiums_contact_phone' => [
227 'name' => 'premiums_contact_phone',
228 'type' => CRM_Utils_Type
::T_STRING
,
229 'title' => ts('Premiums Contact Phone'),
230 'description' => ts('This phone number is included in receipts if it is populated and a premium has been selected.'),
232 'size' => CRM_Utils_Type
::BIG
,
233 'where' => 'civicrm_premiums.premiums_contact_phone',
234 'table_name' => 'civicrm_premiums',
235 'entity' => 'Premium',
236 'bao' => 'CRM_Contribute_BAO_Premium',
239 'premiums_display_min_contribution' => [
240 'name' => 'premiums_display_min_contribution',
241 'type' => CRM_Utils_Type
::T_BOOLEAN
,
242 'title' => ts('Display Minimum Contribution?'),
243 'description' => ts('Boolean. Should we automatically display minimum contribution amount text after the premium descriptions.'),
245 'where' => 'civicrm_premiums.premiums_display_min_contribution',
246 'table_name' => 'civicrm_premiums',
247 'entity' => 'Premium',
248 'bao' => 'CRM_Contribute_BAO_Premium',
251 'premiums_nothankyou_label' => [
252 'name' => 'premiums_nothankyou_label',
253 'type' => CRM_Utils_Type
::T_STRING
,
254 'title' => ts('No Thank-you Text'),
255 'description' => ts('Label displayed for No Thank-you option in premiums block (e.g. No thank you)'),
257 'size' => CRM_Utils_Type
::HUGE
,
258 'where' => 'civicrm_premiums.premiums_nothankyou_label',
259 'table_name' => 'civicrm_premiums',
260 'entity' => 'Premium',
261 'bao' => 'CRM_Contribute_BAO_Premium',
264 'premiums_nothankyou_position' => [
265 'name' => 'premiums_nothankyou_position',
266 'type' => CRM_Utils_Type
::T_INT
,
267 'title' => ts('No Thank-you Position'),
268 'where' => 'civicrm_premiums.premiums_nothankyou_position',
270 'table_name' => 'civicrm_premiums',
271 'entity' => 'Premium',
272 'bao' => 'CRM_Contribute_BAO_Premium',
276 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
278 return Civi
::$statics[__CLASS__
]['fields'];
282 * Return a mapping from field-name to the corresponding key (as used in fields()).
285 * Array(string $name => string $uniqueName).
287 public static function &fieldKeys() {
288 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
289 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
291 return Civi
::$statics[__CLASS__
]['fieldKeys'];
295 * Returns the names of this table
299 public static function getTableName() {
300 return CRM_Core_DAO
::getLocaleTableName(self
::$_tableName);
304 * Returns if this table needs to be logged
308 public function getLog() {
313 * Returns the list of fields that can be imported
315 * @param bool $prefix
319 public static function &import($prefix = FALSE) {
320 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'premiums', $prefix, []);
325 * Returns the list of fields that can be exported
327 * @param bool $prefix
331 public static function &export($prefix = FALSE) {
332 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'premiums', $prefix, []);
337 * Returns the list of indices
339 * @param bool $localize
343 public static function indices($localize = TRUE) {
345 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;