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