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:b35b6fb4895df990a55d9015bb82a852)
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 * @param bool $plural
116 * Whether to return the plural version of the title.
118 public static function getEntityTitle($plural = FALSE) {
119 return $plural ?
ts('Premiums') : ts('Premium');
123 * Returns foreign keys and entity references.
126 * [CRM_Core_Reference_Interface]
128 public static function getReferenceColumns() {
129 if (!isset(Civi
::$statics[__CLASS__
]['links'])) {
130 Civi
::$statics[__CLASS__
]['links'] = static::createReferenceColumns(__CLASS__
);
131 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Dynamic(self
::getTableName(), 'entity_id', NULL, 'id', 'entity_table');
132 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'links_callback', Civi
::$statics[__CLASS__
]['links']);
134 return Civi
::$statics[__CLASS__
]['links'];
138 * Returns all the column names of this table
142 public static function &fields() {
143 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
144 Civi
::$statics[__CLASS__
]['fields'] = [
147 'type' => CRM_Utils_Type
::T_INT
,
148 'title' => ts('Premium ID'),
150 'where' => 'civicrm_premiums.id',
151 'table_name' => 'civicrm_premiums',
152 'entity' => 'Premium',
153 'bao' => 'CRM_Contribute_BAO_Premium',
158 'name' => 'entity_table',
159 'type' => CRM_Utils_Type
::T_STRING
,
160 'title' => ts('Premium Entity'),
161 'description' => ts('Joins these premium settings to another object. Always civicrm_contribution_page for now.'),
164 'size' => CRM_Utils_Type
::BIG
,
165 'where' => 'civicrm_premiums.entity_table',
166 'table_name' => 'civicrm_premiums',
167 'entity' => 'Premium',
168 'bao' => 'CRM_Contribute_BAO_Premium',
173 'name' => 'entity_id',
174 'type' => CRM_Utils_Type
::T_INT
,
175 'title' => ts('Premium entity ID'),
177 'where' => 'civicrm_premiums.entity_id',
178 'table_name' => 'civicrm_premiums',
179 'entity' => 'Premium',
180 'bao' => 'CRM_Contribute_BAO_Premium',
184 'premiums_active' => [
185 'name' => 'premiums_active',
186 'type' => CRM_Utils_Type
::T_BOOLEAN
,
187 'title' => ts('Is Premium Active?'),
188 'description' => ts('Is the Premiums feature enabled for this page?'),
190 'where' => 'civicrm_premiums.premiums_active',
192 'table_name' => 'civicrm_premiums',
193 'entity' => 'Premium',
194 'bao' => 'CRM_Contribute_BAO_Premium',
198 'premiums_intro_title' => [
199 'name' => 'premiums_intro_title',
200 'type' => CRM_Utils_Type
::T_STRING
,
201 'title' => ts('Title for Premiums section'),
202 'description' => ts('Title for Premiums section.'),
204 'size' => CRM_Utils_Type
::HUGE
,
205 'where' => 'civicrm_premiums.premiums_intro_title',
206 'table_name' => 'civicrm_premiums',
207 'entity' => 'Premium',
208 'bao' => 'CRM_Contribute_BAO_Premium',
212 'premiums_intro_text' => [
213 'name' => 'premiums_intro_text',
214 'type' => CRM_Utils_Type
::T_TEXT
,
215 'title' => ts('Premium Introductory Text'),
216 'description' => ts('Displayed in <div> at top of Premiums section of page. Text and HTML allowed.'),
217 'where' => 'civicrm_premiums.premiums_intro_text',
218 'table_name' => 'civicrm_premiums',
219 'entity' => 'Premium',
220 'bao' => 'CRM_Contribute_BAO_Premium',
224 'premiums_contact_email' => [
225 'name' => 'premiums_contact_email',
226 'type' => CRM_Utils_Type
::T_STRING
,
227 'title' => ts('Premium Contact Email'),
228 'description' => ts('This email address is included in receipts if it is populated and a premium has been selected.'),
230 'size' => CRM_Utils_Type
::HUGE
,
231 'where' => 'civicrm_premiums.premiums_contact_email',
232 'table_name' => 'civicrm_premiums',
233 'entity' => 'Premium',
234 'bao' => 'CRM_Contribute_BAO_Premium',
238 'premiums_contact_phone' => [
239 'name' => 'premiums_contact_phone',
240 'type' => CRM_Utils_Type
::T_STRING
,
241 'title' => ts('Premiums Contact Phone'),
242 'description' => ts('This phone number is included in receipts if it is populated and a premium has been selected.'),
244 'size' => CRM_Utils_Type
::BIG
,
245 'where' => 'civicrm_premiums.premiums_contact_phone',
246 'table_name' => 'civicrm_premiums',
247 'entity' => 'Premium',
248 'bao' => 'CRM_Contribute_BAO_Premium',
252 'premiums_display_min_contribution' => [
253 'name' => 'premiums_display_min_contribution',
254 'type' => CRM_Utils_Type
::T_BOOLEAN
,
255 'title' => ts('Display Minimum Contribution?'),
256 'description' => ts('Boolean. Should we automatically display minimum contribution amount text after the premium descriptions.'),
258 'where' => 'civicrm_premiums.premiums_display_min_contribution',
259 'table_name' => 'civicrm_premiums',
260 'entity' => 'Premium',
261 'bao' => 'CRM_Contribute_BAO_Premium',
265 'premiums_nothankyou_label' => [
266 'name' => 'premiums_nothankyou_label',
267 'type' => CRM_Utils_Type
::T_STRING
,
268 'title' => ts('No Thank-you Text'),
269 'description' => ts('Label displayed for No Thank-you option in premiums block (e.g. No thank you)'),
271 'size' => CRM_Utils_Type
::HUGE
,
272 'where' => 'civicrm_premiums.premiums_nothankyou_label',
273 'table_name' => 'civicrm_premiums',
274 'entity' => 'Premium',
275 'bao' => 'CRM_Contribute_BAO_Premium',
279 'premiums_nothankyou_position' => [
280 'name' => 'premiums_nothankyou_position',
281 'type' => CRM_Utils_Type
::T_INT
,
282 'title' => ts('No Thank-you Position'),
283 'where' => 'civicrm_premiums.premiums_nothankyou_position',
285 'table_name' => 'civicrm_premiums',
286 'entity' => 'Premium',
287 'bao' => 'CRM_Contribute_BAO_Premium',
292 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
294 return Civi
::$statics[__CLASS__
]['fields'];
298 * Return a mapping from field-name to the corresponding key (as used in fields()).
301 * Array(string $name => string $uniqueName).
303 public static function &fieldKeys() {
304 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
305 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
307 return Civi
::$statics[__CLASS__
]['fieldKeys'];
311 * Returns the names of this table
315 public static function getTableName() {
316 return CRM_Core_DAO
::getLocaleTableName(self
::$_tableName);
320 * Returns if this table needs to be logged
324 public function getLog() {
329 * Returns the list of fields that can be imported
331 * @param bool $prefix
335 public static function &import($prefix = FALSE) {
336 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'premiums', $prefix, []);
341 * Returns the list of fields that can be exported
343 * @param bool $prefix
347 public static function &export($prefix = FALSE) {
348 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'premiums', $prefix, []);
353 * Returns the list of indices
355 * @param bool $localize
359 public static function indices($localize = TRUE) {
361 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;