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/ContributionProduct.xml | |
8 | * DO NOT EDIT. Generated by CRM_Core_CodeGen | |
a9d0587b | 9 | * (GenCodeChecksum:dd95e7a994c6dfe314f149b5ba7d48db) |
e501603b | 10 | */ |
c3fc2621 | 11 | |
f41f0342 | 12 | /** |
c3fc2621 | 13 | * Database access object for the ContributionProduct entity. |
f41f0342 | 14 | */ |
e501603b | 15 | class CRM_Contribute_DAO_ContributionProduct 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_contribution_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 | 31 | /** |
e6ca0a57 | 32 | * @var int |
e501603b TO |
33 | */ |
34 | public $id; | |
c3fc2621 | 35 | |
e501603b | 36 | /** |
e6ca0a57 | 37 | * @var int |
e501603b TO |
38 | */ |
39 | public $product_id; | |
c3fc2621 | 40 | |
e501603b | 41 | /** |
e6ca0a57 | 42 | * @var int |
e501603b TO |
43 | */ |
44 | public $contribution_id; | |
c3fc2621 | 45 | |
e501603b TO |
46 | /** |
47 | * Option value selected if applicable - e.g. color, size etc. | |
48 | * | |
49 | * @var string | |
50 | */ | |
51 | public $product_option; | |
c3fc2621 | 52 | |
e501603b | 53 | /** |
e501603b TO |
54 | * @var int |
55 | */ | |
56 | public $quantity; | |
c3fc2621 | 57 | |
e501603b TO |
58 | /** |
59 | * Optional. Can be used to record the date this product was fulfilled or shipped. | |
60 | * | |
61 | * @var date | |
62 | */ | |
63 | public $fulfilled_date; | |
c3fc2621 | 64 | |
e501603b TO |
65 | /** |
66 | * Actual start date for a time-delimited premium (subscription, service or membership) | |
67 | * | |
68 | * @var date | |
69 | */ | |
70 | public $start_date; | |
c3fc2621 | 71 | |
e501603b TO |
72 | /** |
73 | * Actual end date for a time-delimited premium (subscription, service or membership) | |
74 | * | |
75 | * @var date | |
76 | */ | |
77 | public $end_date; | |
c3fc2621 | 78 | |
e501603b | 79 | /** |
e501603b TO |
80 | * @var text |
81 | */ | |
82 | public $comment; | |
c3fc2621 | 83 | |
e501603b TO |
84 | /** |
85 | * FK to Financial Type(for membership price sets only). | |
86 | * | |
e6ca0a57 | 87 | * @var int |
e501603b TO |
88 | */ |
89 | public $financial_type_id; | |
c3fc2621 | 90 | |
e501603b | 91 | /** |
f41f0342 | 92 | * Class constructor. |
e501603b | 93 | */ |
c3fc2621 | 94 | public function __construct() { |
e501603b TO |
95 | $this->__table = 'civicrm_contribution_product'; |
96 | parent::__construct(); | |
97 | } | |
c3fc2621 | 98 | |
449c4e6b CW |
99 | /** |
100 | * Returns localized title of this entity. | |
101 | */ | |
102 | public static function getEntityTitle() { | |
103 | return ts('Contribution Products'); | |
104 | } | |
105 | ||
e501603b | 106 | /** |
f41f0342 | 107 | * Returns foreign keys and entity references. |
e501603b TO |
108 | * |
109 | * @return array | |
110 | * [CRM_Core_Reference_Interface] | |
111 | */ | |
c3fc2621 | 112 | public static function getReferenceColumns() { |
346aaaba | 113 | if (!isset(Civi::$statics[__CLASS__]['links'])) { |
fa45b5b9 | 114 | Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__); |
c3fc2621 CW |
115 | Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'contribution_id', 'civicrm_contribution', 'id'); |
116 | Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'financial_type_id', 'civicrm_financial_type', 'id'); | |
346aaaba | 117 | CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']); |
e501603b | 118 | } |
346aaaba | 119 | return Civi::$statics[__CLASS__]['links']; |
e501603b | 120 | } |
c3fc2621 | 121 | |
e501603b TO |
122 | /** |
123 | * Returns all the column names of this table | |
124 | * | |
125 | * @return array | |
126 | */ | |
c3fc2621 | 127 | public static function &fields() { |
346aaaba | 128 | if (!isset(Civi::$statics[__CLASS__]['fields'])) { |
c3fc2621 CW |
129 | Civi::$statics[__CLASS__]['fields'] = [ |
130 | 'id' => [ | |
e501603b TO |
131 | 'name' => 'id', |
132 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 CW |
133 | 'title' => ts('Contribution Product ID'), |
134 | 'required' => TRUE, | |
a36434b9 | 135 | 'where' => 'civicrm_contribution_product.id', |
522a26c9 | 136 | 'table_name' => 'civicrm_contribution_product', |
137 | 'entity' => 'ContributionProduct', | |
138 | 'bao' => 'CRM_Contribute_DAO_ContributionProduct', | |
6a7e5e5d | 139 | 'localizable' => 0, |
a9d0587b | 140 | 'add' => '1.4', |
c3fc2621 CW |
141 | ], |
142 | 'product_id' => [ | |
e501603b TO |
143 | 'name' => 'product_id', |
144 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 CW |
145 | 'title' => ts('Product ID'), |
146 | 'required' => TRUE, | |
a36434b9 | 147 | 'where' => 'civicrm_contribution_product.product_id', |
522a26c9 | 148 | 'table_name' => 'civicrm_contribution_product', |
149 | 'entity' => 'ContributionProduct', | |
150 | 'bao' => 'CRM_Contribute_DAO_ContributionProduct', | |
6a7e5e5d | 151 | 'localizable' => 0, |
a9d0587b | 152 | 'add' => '1.4', |
c3fc2621 CW |
153 | ], |
154 | 'contribution_id' => [ | |
e501603b TO |
155 | 'name' => 'contribution_id', |
156 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 CW |
157 | 'title' => ts('Contribution ID'), |
158 | 'required' => TRUE, | |
a36434b9 | 159 | 'where' => 'civicrm_contribution_product.contribution_id', |
522a26c9 | 160 | 'table_name' => 'civicrm_contribution_product', |
161 | 'entity' => 'ContributionProduct', | |
162 | 'bao' => 'CRM_Contribute_DAO_ContributionProduct', | |
6a7e5e5d | 163 | 'localizable' => 0, |
e501603b | 164 | 'FKClassName' => 'CRM_Contribute_DAO_Contribution', |
a9d0587b | 165 | 'add' => '1.4', |
c3fc2621 CW |
166 | ], |
167 | 'product_option' => [ | |
e501603b TO |
168 | 'name' => 'product_option', |
169 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 170 | 'title' => ts('Product Option'), |
215b423e | 171 | 'description' => ts('Option value selected if applicable - e.g. color, size etc.'), |
e501603b TO |
172 | 'maxlength' => 255, |
173 | 'size' => CRM_Utils_Type::HUGE, | |
e501603b | 174 | 'where' => 'civicrm_contribution_product.product_option', |
a36434b9 | 175 | 'export' => TRUE, |
522a26c9 | 176 | 'table_name' => 'civicrm_contribution_product', |
177 | 'entity' => 'ContributionProduct', | |
178 | 'bao' => 'CRM_Contribute_DAO_ContributionProduct', | |
6a7e5e5d | 179 | 'localizable' => 0, |
a9d0587b | 180 | 'add' => '1.4', |
c3fc2621 CW |
181 | ], |
182 | 'quantity' => [ | |
e501603b TO |
183 | 'name' => 'quantity', |
184 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 185 | 'title' => ts('Quantity'), |
e501603b | 186 | 'where' => 'civicrm_contribution_product.quantity', |
a36434b9 | 187 | 'export' => TRUE, |
522a26c9 | 188 | 'table_name' => 'civicrm_contribution_product', |
189 | 'entity' => 'ContributionProduct', | |
190 | 'bao' => 'CRM_Contribute_DAO_ContributionProduct', | |
6a7e5e5d | 191 | 'localizable' => 0, |
a9d0587b | 192 | 'add' => '1.4', |
c3fc2621 CW |
193 | ], |
194 | 'fulfilled_date' => [ | |
e501603b TO |
195 | 'name' => 'fulfilled_date', |
196 | 'type' => CRM_Utils_Type::T_DATE, | |
c3fc2621 | 197 | 'title' => ts('Fulfilled Date'), |
215b423e | 198 | 'description' => ts('Optional. Can be used to record the date this product was fulfilled or shipped.'), |
e501603b | 199 | 'where' => 'civicrm_contribution_product.fulfilled_date', |
a36434b9 | 200 | 'export' => TRUE, |
522a26c9 | 201 | 'table_name' => 'civicrm_contribution_product', |
202 | 'entity' => 'ContributionProduct', | |
203 | 'bao' => 'CRM_Contribute_DAO_ContributionProduct', | |
6a7e5e5d | 204 | 'localizable' => 0, |
a69cf1d1 SL |
205 | 'html' => [ |
206 | 'type' => 'Select Date', | |
207 | 'formatType' => 'activityDate', | |
208 | ], | |
a9d0587b | 209 | 'add' => '1.4', |
c3fc2621 CW |
210 | ], |
211 | 'contribution_start_date' => [ | |
e501603b TO |
212 | 'name' => 'start_date', |
213 | 'type' => CRM_Utils_Type::T_DATE, | |
c3fc2621 | 214 | 'title' => ts('Start date for premium'), |
215b423e | 215 | 'description' => ts('Actual start date for a time-delimited premium (subscription, service or membership)'), |
e501603b | 216 | 'where' => 'civicrm_contribution_product.start_date', |
a36434b9 | 217 | 'export' => TRUE, |
522a26c9 | 218 | 'table_name' => 'civicrm_contribution_product', |
219 | 'entity' => 'ContributionProduct', | |
220 | 'bao' => 'CRM_Contribute_DAO_ContributionProduct', | |
6a7e5e5d | 221 | 'localizable' => 0, |
a9d0587b | 222 | 'add' => '1.4', |
c3fc2621 CW |
223 | ], |
224 | 'contribution_end_date' => [ | |
e501603b TO |
225 | 'name' => 'end_date', |
226 | 'type' => CRM_Utils_Type::T_DATE, | |
c3fc2621 | 227 | 'title' => ts('End date for premium'), |
215b423e | 228 | 'description' => ts('Actual end date for a time-delimited premium (subscription, service or membership)'), |
e501603b | 229 | 'where' => 'civicrm_contribution_product.end_date', |
a36434b9 | 230 | 'export' => TRUE, |
522a26c9 | 231 | 'table_name' => 'civicrm_contribution_product', |
232 | 'entity' => 'ContributionProduct', | |
233 | 'bao' => 'CRM_Contribute_DAO_ContributionProduct', | |
6a7e5e5d | 234 | 'localizable' => 0, |
a9d0587b | 235 | 'add' => '1.4', |
c3fc2621 CW |
236 | ], |
237 | 'comment' => [ | |
e501603b TO |
238 | 'name' => 'comment', |
239 | 'type' => CRM_Utils_Type::T_TEXT, | |
c3fc2621 | 240 | 'title' => ts('Premium comment'), |
a36434b9 | 241 | 'where' => 'civicrm_contribution_product.comment', |
522a26c9 | 242 | 'table_name' => 'civicrm_contribution_product', |
243 | 'entity' => 'ContributionProduct', | |
244 | 'bao' => 'CRM_Contribute_DAO_ContributionProduct', | |
6a7e5e5d | 245 | 'localizable' => 0, |
a9d0587b | 246 | 'add' => '1.4', |
c3fc2621 CW |
247 | ], |
248 | 'financial_type_id' => [ | |
e501603b TO |
249 | 'name' => 'financial_type_id', |
250 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 251 | 'title' => ts('Financial Type'), |
215b423e | 252 | 'description' => ts('FK to Financial Type(for membership price sets only).'), |
a36434b9 | 253 | 'where' => 'civicrm_contribution_product.financial_type_id', |
e501603b | 254 | 'default' => 'NULL', |
522a26c9 | 255 | 'table_name' => 'civicrm_contribution_product', |
256 | 'entity' => 'ContributionProduct', | |
257 | 'bao' => 'CRM_Contribute_DAO_ContributionProduct', | |
6a7e5e5d | 258 | 'localizable' => 0, |
e501603b | 259 | 'FKClassName' => 'CRM_Financial_DAO_FinancialType', |
c3fc2621 | 260 | 'pseudoconstant' => [ |
e501603b TO |
261 | 'table' => 'civicrm_financial_type', |
262 | 'keyColumn' => 'id', | |
263 | 'labelColumn' => 'name', | |
e6ca0a57 | 264 | ], |
a9d0587b | 265 | 'add' => '4.3', |
c3fc2621 CW |
266 | ], |
267 | ]; | |
346aaaba | 268 | CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); |
e501603b | 269 | } |
346aaaba | 270 | return Civi::$statics[__CLASS__]['fields']; |
e501603b | 271 | } |
c3fc2621 | 272 | |
e501603b | 273 | /** |
bd8e0b14 | 274 | * Return a mapping from field-name to the corresponding key (as used in fields()). |
e501603b TO |
275 | * |
276 | * @return array | |
bd8e0b14 | 277 | * Array(string $name => string $uniqueName). |
e501603b | 278 | */ |
c3fc2621 | 279 | public static function &fieldKeys() { |
bd8e0b14 TO |
280 | if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { |
281 | Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); | |
e501603b | 282 | } |
bd8e0b14 | 283 | return Civi::$statics[__CLASS__]['fieldKeys']; |
e501603b | 284 | } |
c3fc2621 | 285 | |
e501603b TO |
286 | /** |
287 | * Returns the names of this table | |
288 | * | |
289 | * @return string | |
290 | */ | |
c3fc2621 | 291 | public static function getTableName() { |
e501603b TO |
292 | return self::$_tableName; |
293 | } | |
c3fc2621 | 294 | |
e501603b TO |
295 | /** |
296 | * Returns if this table needs to be logged | |
297 | * | |
c3fc2621 | 298 | * @return bool |
e501603b | 299 | */ |
c3fc2621 | 300 | public function getLog() { |
e501603b TO |
301 | return self::$_log; |
302 | } | |
c3fc2621 | 303 | |
e501603b TO |
304 | /** |
305 | * Returns the list of fields that can be imported | |
306 | * | |
307 | * @param bool $prefix | |
308 | * | |
309 | * @return array | |
310 | */ | |
c3fc2621 CW |
311 | public static function &import($prefix = FALSE) { |
312 | $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'contribution_product', $prefix, []); | |
60808919 | 313 | return $r; |
e501603b | 314 | } |
c3fc2621 | 315 | |
e501603b TO |
316 | /** |
317 | * Returns the list of fields that can be exported | |
318 | * | |
319 | * @param bool $prefix | |
320 | * | |
321 | * @return array | |
322 | */ | |
c3fc2621 CW |
323 | public static function &export($prefix = FALSE) { |
324 | $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'contribution_product', $prefix, []); | |
60808919 | 325 | return $r; |
e501603b | 326 | } |
c3fc2621 | 327 | |
e7a6b91a AS |
328 | /** |
329 | * Returns the list of indices | |
c3fc2621 CW |
330 | * |
331 | * @param bool $localize | |
332 | * | |
333 | * @return array | |
e7a6b91a AS |
334 | */ |
335 | public static function indices($localize = TRUE) { | |
c3fc2621 | 336 | $indices = []; |
e7a6b91a AS |
337 | return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; |
338 | } | |
c3fc2621 | 339 | |
e501603b | 340 | } |