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' => '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' => 'Is the Premiums feature enabled for this page?',
172 'table_name' => 'civicrm_premiums',
173 'entity' => 'Premium',
174 'bao' => 'CRM_Contribute_BAO_Premium',
177 'premiums_intro_title' => [
178 'name' => 'premiums_intro_title',
179 'type' => CRM_Utils_Type
::T_STRING
,
180 'title' => ts('Title for Premiums section'),
181 'description' => 'Title for Premiums section.',
183 'size' => CRM_Utils_Type
::HUGE
,
184 'table_name' => 'civicrm_premiums',
185 'entity' => 'Premium',
186 'bao' => 'CRM_Contribute_BAO_Premium',
189 'premiums_intro_text' => [
190 'name' => 'premiums_intro_text',
191 'type' => CRM_Utils_Type
::T_TEXT
,
192 'title' => ts('Premium Introductory Text'),
193 'description' => 'Displayed in <div> at top of Premiums section of page. Text and HTML allowed.',
194 'table_name' => 'civicrm_premiums',
195 'entity' => 'Premium',
196 'bao' => 'CRM_Contribute_BAO_Premium',
199 'premiums_contact_email' => [
200 'name' => 'premiums_contact_email',
201 'type' => CRM_Utils_Type
::T_STRING
,
202 'title' => ts('Premium Contact Email'),
203 'description' => 'This email address is included in receipts if it is populated and a premium has been selected.',
205 'size' => CRM_Utils_Type
::HUGE
,
206 'table_name' => 'civicrm_premiums',
207 'entity' => 'Premium',
208 'bao' => 'CRM_Contribute_BAO_Premium',
211 'premiums_contact_phone' => [
212 'name' => 'premiums_contact_phone',
213 'type' => CRM_Utils_Type
::T_STRING
,
214 'title' => ts('Premiums Contact Phone'),
215 'description' => 'This phone number is included in receipts if it is populated and a premium has been selected.',
217 'size' => CRM_Utils_Type
::BIG
,
218 'table_name' => 'civicrm_premiums',
219 'entity' => 'Premium',
220 'bao' => 'CRM_Contribute_BAO_Premium',
223 'premiums_display_min_contribution' => [
224 'name' => 'premiums_display_min_contribution',
225 'type' => CRM_Utils_Type
::T_BOOLEAN
,
226 'title' => ts('Display Minimum Contribution?'),
227 'description' => 'Boolean. Should we automatically display minimum contribution amount text after the premium descriptions.',
229 'table_name' => 'civicrm_premiums',
230 'entity' => 'Premium',
231 'bao' => 'CRM_Contribute_BAO_Premium',
234 'premiums_nothankyou_label' => [
235 'name' => 'premiums_nothankyou_label',
236 'type' => CRM_Utils_Type
::T_STRING
,
237 'title' => ts('No Thank-you Text'),
238 'description' => 'Label displayed for No Thank-you option in premiums block (e.g. No thank you)',
240 'size' => CRM_Utils_Type
::HUGE
,
241 'table_name' => 'civicrm_premiums',
242 'entity' => 'Premium',
243 'bao' => 'CRM_Contribute_BAO_Premium',
246 'premiums_nothankyou_position' => [
247 'name' => 'premiums_nothankyou_position',
248 'type' => CRM_Utils_Type
::T_INT
,
249 'title' => ts('No Thank-you Position'),
251 'table_name' => 'civicrm_premiums',
252 'entity' => 'Premium',
253 'bao' => 'CRM_Contribute_BAO_Premium',
257 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
259 return Civi
::$statics[__CLASS__
]['fields'];
263 * Return a mapping from field-name to the corresponding key (as used in fields()).
266 * Array(string $name => string $uniqueName).
268 public static function &fieldKeys() {
269 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
270 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
272 return Civi
::$statics[__CLASS__
]['fieldKeys'];
276 * Returns the names of this table
280 public static function getTableName() {
281 return CRM_Core_DAO
::getLocaleTableName(self
::$_tableName);
285 * Returns if this table needs to be logged
289 public function getLog() {
294 * Returns the list of fields that can be imported
296 * @param bool $prefix
300 public static function &import($prefix = FALSE) {
301 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'premiums', $prefix, []);
306 * Returns the list of fields that can be exported
308 * @param bool $prefix
312 public static function &export($prefix = FALSE) {
313 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'premiums', $prefix, []);
318 * Returns the list of indices
320 * @param bool $localize
324 public static function indices($localize = TRUE) {
326 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;