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 | |
d31fb4e3 | 9 | * (GenCodeChecksum:09f3e3060480299738b12caf7121662d) |
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 | * | |
e6ca0a57 | 37 | * @var int |
e501603b TO |
38 | */ |
39 | public $id; | |
c3fc2621 | 40 | |
e501603b TO |
41 | /** |
42 | * Foreign key to premiums settings record. | |
43 | * | |
e6ca0a57 | 44 | * @var int |
e501603b TO |
45 | */ |
46 | public $premiums_id; | |
c3fc2621 | 47 | |
e501603b TO |
48 | /** |
49 | * Foreign key to each product object. | |
50 | * | |
e6ca0a57 | 51 | * @var int |
e501603b TO |
52 | */ |
53 | public $product_id; | |
c3fc2621 | 54 | |
e501603b | 55 | /** |
e6ca0a57 | 56 | * @var int |
e501603b TO |
57 | */ |
58 | public $weight; | |
c3fc2621 | 59 | |
e501603b TO |
60 | /** |
61 | * FK to Financial Type. | |
62 | * | |
e6ca0a57 | 63 | * @var int |
e501603b TO |
64 | */ |
65 | public $financial_type_id; | |
c3fc2621 | 66 | |
e501603b | 67 | /** |
f41f0342 | 68 | * Class constructor. |
e501603b | 69 | */ |
c3fc2621 | 70 | public function __construct() { |
e501603b TO |
71 | $this->__table = 'civicrm_premiums_product'; |
72 | parent::__construct(); | |
73 | } | |
c3fc2621 | 74 | |
449c4e6b CW |
75 | /** |
76 | * Returns localized title of this entity. | |
7b66c3b5 AH |
77 | * |
78 | * @param bool $plural | |
79 | * Whether to return the plural version of the title. | |
449c4e6b | 80 | */ |
7b66c3b5 AH |
81 | public static function getEntityTitle($plural = FALSE) { |
82 | return $plural ? ts('Premiums Products') : ts('Premiums Product'); | |
449c4e6b CW |
83 | } |
84 | ||
e501603b | 85 | /** |
f41f0342 | 86 | * Returns foreign keys and entity references. |
e501603b TO |
87 | * |
88 | * @return array | |
89 | * [CRM_Core_Reference_Interface] | |
90 | */ | |
c3fc2621 | 91 | public static function getReferenceColumns() { |
346aaaba | 92 | if (!isset(Civi::$statics[__CLASS__]['links'])) { |
fa45b5b9 | 93 | Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__); |
c3fc2621 CW |
94 | Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'premiums_id', 'civicrm_premiums', 'id'); |
95 | Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'product_id', 'civicrm_product', 'id'); | |
96 | Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'financial_type_id', 'civicrm_financial_type', 'id'); | |
346aaaba | 97 | CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']); |
e501603b | 98 | } |
346aaaba | 99 | return Civi::$statics[__CLASS__]['links']; |
e501603b | 100 | } |
c3fc2621 | 101 | |
e501603b TO |
102 | /** |
103 | * Returns all the column names of this table | |
104 | * | |
105 | * @return array | |
106 | */ | |
c3fc2621 | 107 | public static function &fields() { |
346aaaba | 108 | if (!isset(Civi::$statics[__CLASS__]['fields'])) { |
c3fc2621 CW |
109 | Civi::$statics[__CLASS__]['fields'] = [ |
110 | 'id' => [ | |
e501603b TO |
111 | 'name' => 'id', |
112 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 113 | 'title' => ts('Premium Product ID'), |
215b423e | 114 | 'description' => ts('Contribution ID'), |
c3fc2621 | 115 | 'required' => TRUE, |
a36434b9 | 116 | 'where' => 'civicrm_premiums_product.id', |
522a26c9 | 117 | 'table_name' => 'civicrm_premiums_product', |
118 | 'entity' => 'PremiumsProduct', | |
119 | 'bao' => 'CRM_Contribute_DAO_PremiumsProduct', | |
6a7e5e5d | 120 | 'localizable' => 0, |
a9d0587b | 121 | 'add' => '1.4', |
c3fc2621 CW |
122 | ], |
123 | 'premiums_id' => [ | |
e501603b TO |
124 | 'name' => 'premiums_id', |
125 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 126 | 'title' => ts('Premium'), |
215b423e | 127 | 'description' => ts('Foreign key to premiums settings record.'), |
c3fc2621 | 128 | 'required' => TRUE, |
a36434b9 | 129 | 'where' => 'civicrm_premiums_product.premiums_id', |
522a26c9 | 130 | 'table_name' => 'civicrm_premiums_product', |
131 | 'entity' => 'PremiumsProduct', | |
132 | 'bao' => 'CRM_Contribute_DAO_PremiumsProduct', | |
6a7e5e5d | 133 | 'localizable' => 0, |
e501603b | 134 | 'FKClassName' => 'CRM_Contribute_DAO_Premium', |
a9d0587b | 135 | 'add' => '1.4', |
c3fc2621 CW |
136 | ], |
137 | 'product_id' => [ | |
e501603b TO |
138 | 'name' => 'product_id', |
139 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 140 | 'title' => ts('Product'), |
215b423e | 141 | 'description' => ts('Foreign key to each product object.'), |
c3fc2621 | 142 | 'required' => TRUE, |
a36434b9 | 143 | 'where' => 'civicrm_premiums_product.product_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_Product', |
a9d0587b | 149 | 'add' => '1.4', |
c3fc2621 CW |
150 | ], |
151 | 'weight' => [ | |
e501603b TO |
152 | 'name' => 'weight', |
153 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 CW |
154 | 'title' => ts('Order'), |
155 | 'required' => TRUE, | |
a36434b9 | 156 | 'where' => 'civicrm_premiums_product.weight', |
522a26c9 | 157 | 'table_name' => 'civicrm_premiums_product', |
158 | 'entity' => 'PremiumsProduct', | |
159 | 'bao' => 'CRM_Contribute_DAO_PremiumsProduct', | |
6a7e5e5d | 160 | 'localizable' => 0, |
a9d0587b | 161 | 'add' => '2.0', |
c3fc2621 CW |
162 | ], |
163 | 'financial_type_id' => [ | |
e501603b TO |
164 | 'name' => 'financial_type_id', |
165 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 166 | 'title' => ts('Financial Type'), |
215b423e | 167 | 'description' => ts('FK to Financial Type.'), |
a36434b9 | 168 | 'where' => 'civicrm_premiums_product.financial_type_id', |
e501603b | 169 | 'default' => 'NULL', |
522a26c9 | 170 | 'table_name' => 'civicrm_premiums_product', |
171 | 'entity' => 'PremiumsProduct', | |
172 | 'bao' => 'CRM_Contribute_DAO_PremiumsProduct', | |
6a7e5e5d | 173 | 'localizable' => 0, |
e501603b | 174 | 'FKClassName' => 'CRM_Financial_DAO_FinancialType', |
c3fc2621 | 175 | 'pseudoconstant' => [ |
e501603b TO |
176 | 'table' => 'civicrm_financial_type', |
177 | 'keyColumn' => 'id', | |
178 | 'labelColumn' => 'name', | |
e6ca0a57 | 179 | ], |
a9d0587b | 180 | 'add' => '4.3', |
c3fc2621 CW |
181 | ], |
182 | ]; | |
346aaaba | 183 | CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); |
e501603b | 184 | } |
346aaaba | 185 | return Civi::$statics[__CLASS__]['fields']; |
e501603b | 186 | } |
c3fc2621 | 187 | |
e501603b | 188 | /** |
bd8e0b14 | 189 | * Return a mapping from field-name to the corresponding key (as used in fields()). |
e501603b TO |
190 | * |
191 | * @return array | |
bd8e0b14 | 192 | * Array(string $name => string $uniqueName). |
e501603b | 193 | */ |
c3fc2621 | 194 | public static function &fieldKeys() { |
bd8e0b14 TO |
195 | if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { |
196 | Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); | |
e501603b | 197 | } |
bd8e0b14 | 198 | return Civi::$statics[__CLASS__]['fieldKeys']; |
e501603b | 199 | } |
c3fc2621 | 200 | |
e501603b TO |
201 | /** |
202 | * Returns the names of this table | |
203 | * | |
204 | * @return string | |
205 | */ | |
c3fc2621 | 206 | public static function getTableName() { |
e501603b TO |
207 | return self::$_tableName; |
208 | } | |
c3fc2621 | 209 | |
e501603b TO |
210 | /** |
211 | * Returns if this table needs to be logged | |
212 | * | |
c3fc2621 | 213 | * @return bool |
e501603b | 214 | */ |
c3fc2621 | 215 | public function getLog() { |
e501603b TO |
216 | return self::$_log; |
217 | } | |
c3fc2621 | 218 | |
e501603b TO |
219 | /** |
220 | * Returns the list of fields that can be imported | |
221 | * | |
222 | * @param bool $prefix | |
223 | * | |
224 | * @return array | |
225 | */ | |
c3fc2621 CW |
226 | public static function &import($prefix = FALSE) { |
227 | $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'premiums_product', $prefix, []); | |
60808919 | 228 | return $r; |
e501603b | 229 | } |
c3fc2621 | 230 | |
e501603b TO |
231 | /** |
232 | * Returns the list of fields that can be exported | |
233 | * | |
234 | * @param bool $prefix | |
235 | * | |
236 | * @return array | |
237 | */ | |
c3fc2621 CW |
238 | public static function &export($prefix = FALSE) { |
239 | $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'premiums_product', $prefix, []); | |
60808919 | 240 | return $r; |
e501603b | 241 | } |
c3fc2621 | 242 | |
e7a6b91a AS |
243 | /** |
244 | * Returns the list of indices | |
c3fc2621 CW |
245 | * |
246 | * @param bool $localize | |
247 | * | |
248 | * @return array | |
e7a6b91a AS |
249 | */ |
250 | public static function indices($localize = TRUE) { | |
c3fc2621 | 251 | $indices = []; |
e7a6b91a AS |
252 | return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; |
253 | } | |
c3fc2621 | 254 | |
e501603b | 255 | } |