Merge pull request #14716 from eileenmcnaughton/db
[civicrm-core.git] / CRM / Contribute / DAO / PremiumsProduct.php
CommitLineData
e501603b 1<?php
c3fc2621 2
e501603b
TO
3/**
4 * @package CRM
6b83d5bd 5 * @copyright CiviCRM LLC (c) 2004-2019
e501603b
TO
6 *
7 * Generated from xml/schema/CRM/Contribute/PremiumsProduct.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
74db51d3 9 * (GenCodeChecksum:c165125a7d8f92c40a68bdad3715d28d)
e501603b 10 */
c3fc2621 11
f41f0342 12/**
c3fc2621 13 * Database access object for the PremiumsProduct entity.
f41f0342 14 */
e501603b 15class CRM_Contribute_DAO_PremiumsProduct extends CRM_Core_DAO {
c3fc2621 16
e501603b 17 /**
f41f0342 18 * Static instance to hold the table name.
e501603b
TO
19 *
20 * @var string
21 */
fa45b5b9 22 public static $_tableName = 'civicrm_premiums_product';
c3fc2621 23
e501603b 24 /**
f41f0342 25 * Should CiviCRM log any modifications to this table in the civicrm_log table.
e501603b 26 *
c3fc2621 27 * @var bool
e501603b 28 */
fa45b5b9 29 public static $_log = TRUE;
c3fc2621 30
e501603b
TO
31 /**
32 * Contribution ID
33 *
e6ca0a57 34 * @var int
e501603b
TO
35 */
36 public $id;
c3fc2621 37
e501603b
TO
38 /**
39 * Foreign key to premiums settings record.
40 *
e6ca0a57 41 * @var int
e501603b
TO
42 */
43 public $premiums_id;
c3fc2621 44
e501603b
TO
45 /**
46 * Foreign key to each product object.
47 *
e6ca0a57 48 * @var int
e501603b
TO
49 */
50 public $product_id;
c3fc2621 51
e501603b 52 /**
e6ca0a57 53 * @var int
e501603b
TO
54 */
55 public $weight;
c3fc2621 56
e501603b
TO
57 /**
58 * FK to Financial Type.
59 *
e6ca0a57 60 * @var int
e501603b
TO
61 */
62 public $financial_type_id;
c3fc2621 63
e501603b 64 /**
f41f0342 65 * Class constructor.
e501603b 66 */
c3fc2621 67 public function __construct() {
e501603b
TO
68 $this->__table = 'civicrm_premiums_product';
69 parent::__construct();
70 }
c3fc2621 71
e501603b 72 /**
f41f0342 73 * Returns foreign keys and entity references.
e501603b
TO
74 *
75 * @return array
76 * [CRM_Core_Reference_Interface]
77 */
c3fc2621 78 public static function getReferenceColumns() {
346aaaba 79 if (!isset(Civi::$statics[__CLASS__]['links'])) {
fa45b5b9 80 Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__);
c3fc2621
CW
81 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'premiums_id', 'civicrm_premiums', 'id');
82 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'product_id', 'civicrm_product', 'id');
83 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'financial_type_id', 'civicrm_financial_type', 'id');
346aaaba 84 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
e501603b 85 }
346aaaba 86 return Civi::$statics[__CLASS__]['links'];
e501603b 87 }
c3fc2621 88
e501603b
TO
89 /**
90 * Returns all the column names of this table
91 *
92 * @return array
93 */
c3fc2621 94 public static function &fields() {
346aaaba 95 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
c3fc2621
CW
96 Civi::$statics[__CLASS__]['fields'] = [
97 'id' => [
e501603b
TO
98 'name' => 'id',
99 'type' => CRM_Utils_Type::T_INT,
c3fc2621 100 'title' => ts('Premium Product ID'),
215b423e 101 'description' => ts('Contribution ID'),
c3fc2621 102 'required' => TRUE,
a36434b9 103 'where' => 'civicrm_premiums_product.id',
522a26c9 104 'table_name' => 'civicrm_premiums_product',
105 'entity' => 'PremiumsProduct',
106 'bao' => 'CRM_Contribute_DAO_PremiumsProduct',
6a7e5e5d 107 'localizable' => 0,
c3fc2621
CW
108 ],
109 'premiums_id' => [
e501603b
TO
110 'name' => 'premiums_id',
111 'type' => CRM_Utils_Type::T_INT,
c3fc2621 112 'title' => ts('Premium'),
215b423e 113 'description' => ts('Foreign key to premiums settings record.'),
c3fc2621 114 'required' => TRUE,
a36434b9 115 'where' => 'civicrm_premiums_product.premiums_id',
522a26c9 116 'table_name' => 'civicrm_premiums_product',
117 'entity' => 'PremiumsProduct',
118 'bao' => 'CRM_Contribute_DAO_PremiumsProduct',
6a7e5e5d 119 'localizable' => 0,
e501603b 120 'FKClassName' => 'CRM_Contribute_DAO_Premium',
c3fc2621
CW
121 ],
122 'product_id' => [
e501603b
TO
123 'name' => 'product_id',
124 'type' => CRM_Utils_Type::T_INT,
c3fc2621 125 'title' => ts('Product'),
215b423e 126 'description' => ts('Foreign key to each product object.'),
c3fc2621 127 'required' => TRUE,
a36434b9 128 'where' => 'civicrm_premiums_product.product_id',
522a26c9 129 'table_name' => 'civicrm_premiums_product',
130 'entity' => 'PremiumsProduct',
131 'bao' => 'CRM_Contribute_DAO_PremiumsProduct',
6a7e5e5d 132 'localizable' => 0,
e501603b 133 'FKClassName' => 'CRM_Contribute_DAO_Product',
c3fc2621
CW
134 ],
135 'weight' => [
e501603b
TO
136 'name' => 'weight',
137 'type' => CRM_Utils_Type::T_INT,
c3fc2621
CW
138 'title' => ts('Order'),
139 'required' => TRUE,
a36434b9 140 'where' => 'civicrm_premiums_product.weight',
522a26c9 141 'table_name' => 'civicrm_premiums_product',
142 'entity' => 'PremiumsProduct',
143 'bao' => 'CRM_Contribute_DAO_PremiumsProduct',
6a7e5e5d 144 'localizable' => 0,
c3fc2621
CW
145 ],
146 'financial_type_id' => [
e501603b
TO
147 'name' => 'financial_type_id',
148 'type' => CRM_Utils_Type::T_INT,
c3fc2621 149 'title' => ts('Financial Type'),
215b423e 150 'description' => ts('FK to Financial Type.'),
a36434b9 151 'where' => 'civicrm_premiums_product.financial_type_id',
e501603b 152 'default' => 'NULL',
522a26c9 153 'table_name' => 'civicrm_premiums_product',
154 'entity' => 'PremiumsProduct',
155 'bao' => 'CRM_Contribute_DAO_PremiumsProduct',
6a7e5e5d 156 'localizable' => 0,
e501603b 157 'FKClassName' => 'CRM_Financial_DAO_FinancialType',
c3fc2621 158 'pseudoconstant' => [
e501603b
TO
159 'table' => 'civicrm_financial_type',
160 'keyColumn' => 'id',
161 'labelColumn' => 'name',
e6ca0a57 162 ],
c3fc2621
CW
163 ],
164 ];
346aaaba 165 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
e501603b 166 }
346aaaba 167 return Civi::$statics[__CLASS__]['fields'];
e501603b 168 }
c3fc2621 169
e501603b 170 /**
bd8e0b14 171 * Return a mapping from field-name to the corresponding key (as used in fields()).
e501603b
TO
172 *
173 * @return array
bd8e0b14 174 * Array(string $name => string $uniqueName).
e501603b 175 */
c3fc2621 176 public static function &fieldKeys() {
bd8e0b14
TO
177 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
178 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
e501603b 179 }
bd8e0b14 180 return Civi::$statics[__CLASS__]['fieldKeys'];
e501603b 181 }
c3fc2621 182
e501603b
TO
183 /**
184 * Returns the names of this table
185 *
186 * @return string
187 */
c3fc2621 188 public static function getTableName() {
e501603b
TO
189 return self::$_tableName;
190 }
c3fc2621 191
e501603b
TO
192 /**
193 * Returns if this table needs to be logged
194 *
c3fc2621 195 * @return bool
e501603b 196 */
c3fc2621 197 public function getLog() {
e501603b
TO
198 return self::$_log;
199 }
c3fc2621 200
e501603b
TO
201 /**
202 * Returns the list of fields that can be imported
203 *
204 * @param bool $prefix
205 *
206 * @return array
207 */
c3fc2621
CW
208 public static function &import($prefix = FALSE) {
209 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'premiums_product', $prefix, []);
60808919 210 return $r;
e501603b 211 }
c3fc2621 212
e501603b
TO
213 /**
214 * Returns the list of fields that can be exported
215 *
216 * @param bool $prefix
217 *
218 * @return array
219 */
c3fc2621
CW
220 public static function &export($prefix = FALSE) {
221 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'premiums_product', $prefix, []);
60808919 222 return $r;
e501603b 223 }
c3fc2621 224
e7a6b91a
AS
225 /**
226 * Returns the list of indices
c3fc2621
CW
227 *
228 * @param bool $localize
229 *
230 * @return array
e7a6b91a
AS
231 */
232 public static function indices($localize = TRUE) {
c3fc2621 233 $indices = [];
e7a6b91a
AS
234 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
235 }
c3fc2621 236
e501603b 237}