5 * @copyright CiviCRM LLC (c) 2004-2018
7 * Generated from xml/schema/CRM/Contribute/Premium.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:86a5118380bd35cee851da735f699ac2)
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 static $_tableName = 'civicrm_premiums';
25 * Should CiviCRM log any modifications to this table in the civicrm_log table.
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 'table_name' => 'civicrm_premiums',
139 'entity' => 'Premium',
140 'bao' => 'CRM_Contribute_BAO_Premium',
144 'name' => 'entity_table',
145 'type' => CRM_Utils_Type
::T_STRING
,
146 'title' => ts('Premium Entity'),
147 'description' => ts('Joins these premium settings to another object. Always civicrm_contribution_page for now.'),
150 'size' => CRM_Utils_Type
::BIG
,
151 'table_name' => 'civicrm_premiums',
152 'entity' => 'Premium',
153 'bao' => 'CRM_Contribute_BAO_Premium',
157 'name' => 'entity_id',
158 'type' => CRM_Utils_Type
::T_INT
,
159 'title' => ts('Premium entity ID'),
161 'table_name' => 'civicrm_premiums',
162 'entity' => 'Premium',
163 'bao' => 'CRM_Contribute_BAO_Premium',
166 'premiums_active' => [
167 'name' => 'premiums_active',
168 'type' => CRM_Utils_Type
::T_BOOLEAN
,
169 'title' => ts('Is Premium Active?'),
170 'description' => ts('Is the Premiums feature enabled for this page?'),
173 'table_name' => 'civicrm_premiums',
174 'entity' => 'Premium',
175 'bao' => 'CRM_Contribute_BAO_Premium',
178 'premiums_intro_title' => [
179 'name' => 'premiums_intro_title',
180 'type' => CRM_Utils_Type
::T_STRING
,
181 'title' => ts('Title for Premiums section'),
182 'description' => ts('Title for Premiums section.'),
184 'size' => CRM_Utils_Type
::HUGE
,
185 'table_name' => 'civicrm_premiums',
186 'entity' => 'Premium',
187 'bao' => 'CRM_Contribute_BAO_Premium',
190 'premiums_intro_text' => [
191 'name' => 'premiums_intro_text',
192 'type' => CRM_Utils_Type
::T_TEXT
,
193 'title' => ts('Premium Introductory Text'),
194 'description' => ts('Displayed in <div> at top of Premiums section of page. Text and HTML allowed.'),
195 'table_name' => 'civicrm_premiums',
196 'entity' => 'Premium',
197 'bao' => 'CRM_Contribute_BAO_Premium',
200 'premiums_contact_email' => [
201 'name' => 'premiums_contact_email',
202 'type' => CRM_Utils_Type
::T_STRING
,
203 'title' => ts('Premium Contact Email'),
204 'description' => ts('This email address is included in receipts if it is populated and a premium has been selected.'),
206 'size' => CRM_Utils_Type
::HUGE
,
207 'table_name' => 'civicrm_premiums',
208 'entity' => 'Premium',
209 'bao' => 'CRM_Contribute_BAO_Premium',
212 'premiums_contact_phone' => [
213 'name' => 'premiums_contact_phone',
214 'type' => CRM_Utils_Type
::T_STRING
,
215 'title' => ts('Premiums Contact Phone'),
216 'description' => ts('This phone number is included in receipts if it is populated and a premium has been selected.'),
218 'size' => CRM_Utils_Type
::BIG
,
219 'table_name' => 'civicrm_premiums',
220 'entity' => 'Premium',
221 'bao' => 'CRM_Contribute_BAO_Premium',
224 'premiums_display_min_contribution' => [
225 'name' => 'premiums_display_min_contribution',
226 'type' => CRM_Utils_Type
::T_BOOLEAN
,
227 'title' => ts('Display Minimum Contribution?'),
228 'description' => ts('Boolean. Should we automatically display minimum contribution amount text after the premium descriptions.'),
230 'table_name' => 'civicrm_premiums',
231 'entity' => 'Premium',
232 'bao' => 'CRM_Contribute_BAO_Premium',
235 'premiums_nothankyou_label' => [
236 'name' => 'premiums_nothankyou_label',
237 'type' => CRM_Utils_Type
::T_STRING
,
238 'title' => ts('No Thank-you Text'),
239 'description' => ts('Label displayed for No Thank-you option in premiums block (e.g. No thank you)'),
241 'size' => CRM_Utils_Type
::HUGE
,
242 'table_name' => 'civicrm_premiums',
243 'entity' => 'Premium',
244 'bao' => 'CRM_Contribute_BAO_Premium',
247 'premiums_nothankyou_position' => [
248 'name' => 'premiums_nothankyou_position',
249 'type' => CRM_Utils_Type
::T_INT
,
250 'title' => ts('No Thank-you Position'),
252 'table_name' => 'civicrm_premiums',
253 'entity' => 'Premium',
254 'bao' => 'CRM_Contribute_BAO_Premium',
258 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
260 return Civi
::$statics[__CLASS__
]['fields'];
264 * Return a mapping from field-name to the corresponding key (as used in fields()).
267 * Array(string $name => string $uniqueName).
269 public static function &fieldKeys() {
270 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
271 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
273 return Civi
::$statics[__CLASS__
]['fieldKeys'];
277 * Returns the names of this table
281 public static function getTableName() {
282 return CRM_Core_DAO
::getLocaleTableName(self
::$_tableName);
286 * Returns if this table needs to be logged
290 public function getLog() {
295 * Returns the list of fields that can be imported
297 * @param bool $prefix
301 public static function &import($prefix = FALSE) {
302 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'premiums', $prefix, []);
307 * Returns the list of fields that can be exported
309 * @param bool $prefix
313 public static function &export($prefix = FALSE) {
314 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'premiums', $prefix, []);
319 * Returns the list of indices
321 * @param bool $localize
325 public static function indices($localize = TRUE) {
327 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;