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:4fc24f46e0da197aafb4399dd0965aa4)
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';
18 const COMPONENT
= 'CiviContribute';
21 * Static instance to hold the table name.
25 public static $_tableName = 'civicrm_premiums';
28 * Should CiviCRM log any modifications to this table in the civicrm_log table.
32 public static $_log = TRUE;
35 * @var int|string|null
36 * (SQL type: int unsigned)
37 * Note that values will be retrieved from the database as a string.
42 * Joins these premium settings to another object. Always civicrm_contribution_page for now.
45 * (SQL type: varchar(64))
46 * Note that values will be retrieved from the database as a string.
52 * (SQL type: int unsigned)
53 * Note that values will be retrieved from the database as a string.
58 * Is the Premiums feature enabled for this page?
62 * Note that values will be retrieved from the database as a string.
64 public $premiums_active;
67 * Title for Premiums section.
70 * (SQL type: varchar(255))
71 * Note that values will be retrieved from the database as a string.
73 public $premiums_intro_title;
76 * Displayed in <div> at top of Premiums section of page. Text and HTML allowed.
80 * Note that values will be retrieved from the database as a string.
82 public $premiums_intro_text;
85 * This email address is included in receipts if it is populated and a premium has been selected.
88 * (SQL type: varchar(100))
89 * Note that values will be retrieved from the database as a string.
91 public $premiums_contact_email;
94 * This phone number is included in receipts if it is populated and a premium has been selected.
97 * (SQL type: varchar(50))
98 * Note that values will be retrieved from the database as a string.
100 public $premiums_contact_phone;
103 * Boolean. Should we automatically display minimum contribution amount text after the premium descriptions.
106 * (SQL type: tinyint)
107 * Note that values will be retrieved from the database as a string.
109 public $premiums_display_min_contribution;
112 * Label displayed for No Thank-you option in premiums block (e.g. No thank you)
115 * (SQL type: varchar(255))
116 * Note that values will be retrieved from the database as a string.
118 public $premiums_nothankyou_label;
121 * @var int|string|null
122 * (SQL type: int unsigned)
123 * Note that values will be retrieved from the database as a string.
125 public $premiums_nothankyou_position;
130 public function __construct() {
131 $this->__table
= 'civicrm_premiums';
132 parent
::__construct();
136 * Returns localized title of this entity.
138 * @param bool $plural
139 * Whether to return the plural version of the title.
141 public static function getEntityTitle($plural = FALSE) {
142 return $plural ?
ts('Premiums') : ts('Premium');
146 * Returns foreign keys and entity references.
149 * [CRM_Core_Reference_Interface]
151 public static function getReferenceColumns() {
152 if (!isset(Civi
::$statics[__CLASS__
]['links'])) {
153 Civi
::$statics[__CLASS__
]['links'] = static::createReferenceColumns(__CLASS__
);
154 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Dynamic(self
::getTableName(), 'entity_id', NULL, 'id', 'entity_table');
155 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'links_callback', Civi
::$statics[__CLASS__
]['links']);
157 return Civi
::$statics[__CLASS__
]['links'];
161 * Returns all the column names of this table
165 public static function &fields() {
166 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
167 Civi
::$statics[__CLASS__
]['fields'] = [
170 'type' => CRM_Utils_Type
::T_INT
,
171 'title' => ts('Premium ID'),
173 'where' => 'civicrm_premiums.id',
174 'table_name' => 'civicrm_premiums',
175 'entity' => 'Premium',
176 'bao' => 'CRM_Contribute_BAO_Premium',
185 'name' => 'entity_table',
186 'type' => CRM_Utils_Type
::T_STRING
,
187 'title' => ts('Premium Entity'),
188 'description' => ts('Joins these premium settings to another object. Always civicrm_contribution_page for now.'),
191 'size' => CRM_Utils_Type
::BIG
,
192 'where' => 'civicrm_premiums.entity_table',
193 'table_name' => 'civicrm_premiums',
194 'entity' => 'Premium',
195 'bao' => 'CRM_Contribute_BAO_Premium',
200 'name' => 'entity_id',
201 'type' => CRM_Utils_Type
::T_INT
,
202 'title' => ts('Premium entity ID'),
204 'where' => 'civicrm_premiums.entity_id',
205 'table_name' => 'civicrm_premiums',
206 'entity' => 'Premium',
207 'bao' => 'CRM_Contribute_BAO_Premium',
211 'premiums_active' => [
212 'name' => 'premiums_active',
213 'type' => CRM_Utils_Type
::T_BOOLEAN
,
214 'title' => ts('Is Premium Active?'),
215 'description' => ts('Is the Premiums feature enabled for this page?'),
217 'where' => 'civicrm_premiums.premiums_active',
219 'table_name' => 'civicrm_premiums',
220 'entity' => 'Premium',
221 'bao' => 'CRM_Contribute_BAO_Premium',
225 'premiums_intro_title' => [
226 'name' => 'premiums_intro_title',
227 'type' => CRM_Utils_Type
::T_STRING
,
228 'title' => ts('Title for Premiums section'),
229 'description' => ts('Title for Premiums section.'),
231 'size' => CRM_Utils_Type
::HUGE
,
232 'where' => 'civicrm_premiums.premiums_intro_title',
233 'table_name' => 'civicrm_premiums',
234 'entity' => 'Premium',
235 'bao' => 'CRM_Contribute_BAO_Premium',
239 'premiums_intro_text' => [
240 'name' => 'premiums_intro_text',
241 'type' => CRM_Utils_Type
::T_TEXT
,
242 'title' => ts('Premium Introductory Text'),
243 'description' => ts('Displayed in <div> at top of Premiums section of page. Text and HTML allowed.'),
244 'where' => 'civicrm_premiums.premiums_intro_text',
245 'table_name' => 'civicrm_premiums',
246 'entity' => 'Premium',
247 'bao' => 'CRM_Contribute_BAO_Premium',
251 'premiums_contact_email' => [
252 'name' => 'premiums_contact_email',
253 'type' => CRM_Utils_Type
::T_STRING
,
254 'title' => ts('Premium Contact Email'),
255 'description' => ts('This email address is included in receipts if it is populated and a premium has been selected.'),
257 'size' => CRM_Utils_Type
::HUGE
,
258 'where' => 'civicrm_premiums.premiums_contact_email',
259 'table_name' => 'civicrm_premiums',
260 'entity' => 'Premium',
261 'bao' => 'CRM_Contribute_BAO_Premium',
265 'premiums_contact_phone' => [
266 'name' => 'premiums_contact_phone',
267 'type' => CRM_Utils_Type
::T_STRING
,
268 'title' => ts('Premiums Contact Phone'),
269 'description' => ts('This phone number is included in receipts if it is populated and a premium has been selected.'),
271 'size' => CRM_Utils_Type
::BIG
,
272 'where' => 'civicrm_premiums.premiums_contact_phone',
273 'table_name' => 'civicrm_premiums',
274 'entity' => 'Premium',
275 'bao' => 'CRM_Contribute_BAO_Premium',
279 'premiums_display_min_contribution' => [
280 'name' => 'premiums_display_min_contribution',
281 'type' => CRM_Utils_Type
::T_BOOLEAN
,
282 'title' => ts('Display Minimum Contribution?'),
283 'description' => ts('Boolean. Should we automatically display minimum contribution amount text after the premium descriptions.'),
285 'where' => 'civicrm_premiums.premiums_display_min_contribution',
287 'table_name' => 'civicrm_premiums',
288 'entity' => 'Premium',
289 'bao' => 'CRM_Contribute_BAO_Premium',
293 'premiums_nothankyou_label' => [
294 'name' => 'premiums_nothankyou_label',
295 'type' => CRM_Utils_Type
::T_STRING
,
296 'title' => ts('No Thank-you Text'),
297 'description' => ts('Label displayed for No Thank-you option in premiums block (e.g. No thank you)'),
299 'size' => CRM_Utils_Type
::HUGE
,
300 'where' => 'civicrm_premiums.premiums_nothankyou_label',
301 'table_name' => 'civicrm_premiums',
302 'entity' => 'Premium',
303 'bao' => 'CRM_Contribute_BAO_Premium',
307 'premiums_nothankyou_position' => [
308 'name' => 'premiums_nothankyou_position',
309 'type' => CRM_Utils_Type
::T_INT
,
310 'title' => ts('No Thank-you Position'),
311 'where' => 'civicrm_premiums.premiums_nothankyou_position',
313 'table_name' => 'civicrm_premiums',
314 'entity' => 'Premium',
315 'bao' => 'CRM_Contribute_BAO_Premium',
320 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
322 return Civi
::$statics[__CLASS__
]['fields'];
326 * Return a mapping from field-name to the corresponding key (as used in fields()).
329 * Array(string $name => string $uniqueName).
331 public static function &fieldKeys() {
332 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
333 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
335 return Civi
::$statics[__CLASS__
]['fieldKeys'];
339 * Returns the names of this table
343 public static function getTableName() {
344 return CRM_Core_DAO
::getLocaleTableName(self
::$_tableName);
348 * Returns if this table needs to be logged
352 public function getLog() {
357 * Returns the list of fields that can be imported
359 * @param bool $prefix
363 public static function &import($prefix = FALSE) {
364 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'premiums', $prefix, []);
369 * Returns the list of fields that can be exported
371 * @param bool $prefix
375 public static function &export($prefix = FALSE) {
376 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'premiums', $prefix, []);
381 * Returns the list of indices
383 * @param bool $localize
387 public static function indices($localize = TRUE) {
389 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;