5 * @copyright CiviCRM LLC https://civicrm.org/licensing
7 * Generated from xml/schema/CRM/Contribute/ContributionProduct.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:ff8ff52e402d36b2d488ec5cda68ff12)
13 * Database access object for the ContributionProduct entity.
15 class CRM_Contribute_DAO_ContributionProduct
extends CRM_Core_DAO
{
18 * Static instance to hold the table name.
22 public static $_tableName = 'civicrm_contribution_product';
25 * Should CiviCRM log any modifications to this table in the civicrm_log table.
29 public static $_log = TRUE;
44 public $contribution_id;
47 * Option value selected if applicable - e.g. color, size etc.
51 public $product_option;
59 * Optional. Can be used to record the date this product was fulfilled or shipped.
63 public $fulfilled_date;
66 * Actual start date for a time-delimited premium (subscription, service or membership)
73 * Actual end date for a time-delimited premium (subscription, service or membership)
85 * FK to Financial Type(for membership price sets only).
89 public $financial_type_id;
94 public function __construct() {
95 $this->__table
= 'civicrm_contribution_product';
96 parent
::__construct();
100 * Returns foreign keys and entity references.
103 * [CRM_Core_Reference_Interface]
105 public static function getReferenceColumns() {
106 if (!isset(Civi
::$statics[__CLASS__
]['links'])) {
107 Civi
::$statics[__CLASS__
]['links'] = static::createReferenceColumns(__CLASS__
);
108 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'contribution_id', 'civicrm_contribution', 'id');
109 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'financial_type_id', 'civicrm_financial_type', 'id');
110 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'links_callback', Civi
::$statics[__CLASS__
]['links']);
112 return Civi
::$statics[__CLASS__
]['links'];
116 * Returns all the column names of this table
120 public static function &fields() {
121 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
122 Civi
::$statics[__CLASS__
]['fields'] = [
125 'type' => CRM_Utils_Type
::T_INT
,
126 'title' => ts('Contribution Product ID'),
128 'where' => 'civicrm_contribution_product.id',
129 'table_name' => 'civicrm_contribution_product',
130 'entity' => 'ContributionProduct',
131 'bao' => 'CRM_Contribute_DAO_ContributionProduct',
135 'name' => 'product_id',
136 'type' => CRM_Utils_Type
::T_INT
,
137 'title' => ts('Product ID'),
139 'where' => 'civicrm_contribution_product.product_id',
140 'table_name' => 'civicrm_contribution_product',
141 'entity' => 'ContributionProduct',
142 'bao' => 'CRM_Contribute_DAO_ContributionProduct',
145 'contribution_id' => [
146 'name' => 'contribution_id',
147 'type' => CRM_Utils_Type
::T_INT
,
148 'title' => ts('Contribution ID'),
150 'where' => 'civicrm_contribution_product.contribution_id',
151 'table_name' => 'civicrm_contribution_product',
152 'entity' => 'ContributionProduct',
153 'bao' => 'CRM_Contribute_DAO_ContributionProduct',
155 'FKClassName' => 'CRM_Contribute_DAO_Contribution',
157 'product_option' => [
158 'name' => 'product_option',
159 'type' => CRM_Utils_Type
::T_STRING
,
160 'title' => ts('Product Option'),
161 'description' => ts('Option value selected if applicable - e.g. color, size etc.'),
163 'size' => CRM_Utils_Type
::HUGE
,
164 'where' => 'civicrm_contribution_product.product_option',
166 'table_name' => 'civicrm_contribution_product',
167 'entity' => 'ContributionProduct',
168 'bao' => 'CRM_Contribute_DAO_ContributionProduct',
172 'name' => 'quantity',
173 'type' => CRM_Utils_Type
::T_INT
,
174 'title' => ts('Quantity'),
175 'where' => 'civicrm_contribution_product.quantity',
177 'table_name' => 'civicrm_contribution_product',
178 'entity' => 'ContributionProduct',
179 'bao' => 'CRM_Contribute_DAO_ContributionProduct',
182 'fulfilled_date' => [
183 'name' => 'fulfilled_date',
184 'type' => CRM_Utils_Type
::T_DATE
,
185 'title' => ts('Fulfilled Date'),
186 'description' => ts('Optional. Can be used to record the date this product was fulfilled or shipped.'),
187 'where' => 'civicrm_contribution_product.fulfilled_date',
189 'table_name' => 'civicrm_contribution_product',
190 'entity' => 'ContributionProduct',
191 'bao' => 'CRM_Contribute_DAO_ContributionProduct',
194 'type' => 'Select Date',
195 'formatType' => 'activityDate',
198 'contribution_start_date' => [
199 'name' => 'start_date',
200 'type' => CRM_Utils_Type
::T_DATE
,
201 'title' => ts('Start date for premium'),
202 'description' => ts('Actual start date for a time-delimited premium (subscription, service or membership)'),
203 'where' => 'civicrm_contribution_product.start_date',
205 'table_name' => 'civicrm_contribution_product',
206 'entity' => 'ContributionProduct',
207 'bao' => 'CRM_Contribute_DAO_ContributionProduct',
210 'contribution_end_date' => [
211 'name' => 'end_date',
212 'type' => CRM_Utils_Type
::T_DATE
,
213 'title' => ts('End date for premium'),
214 'description' => ts('Actual end date for a time-delimited premium (subscription, service or membership)'),
215 'where' => 'civicrm_contribution_product.end_date',
217 'table_name' => 'civicrm_contribution_product',
218 'entity' => 'ContributionProduct',
219 'bao' => 'CRM_Contribute_DAO_ContributionProduct',
224 'type' => CRM_Utils_Type
::T_TEXT
,
225 'title' => ts('Premium comment'),
226 'where' => 'civicrm_contribution_product.comment',
227 'table_name' => 'civicrm_contribution_product',
228 'entity' => 'ContributionProduct',
229 'bao' => 'CRM_Contribute_DAO_ContributionProduct',
232 'financial_type_id' => [
233 'name' => 'financial_type_id',
234 'type' => CRM_Utils_Type
::T_INT
,
235 'title' => ts('Financial Type'),
236 'description' => ts('FK to Financial Type(for membership price sets only).'),
237 'where' => 'civicrm_contribution_product.financial_type_id',
239 'table_name' => 'civicrm_contribution_product',
240 'entity' => 'ContributionProduct',
241 'bao' => 'CRM_Contribute_DAO_ContributionProduct',
243 'FKClassName' => 'CRM_Financial_DAO_FinancialType',
244 'pseudoconstant' => [
245 'table' => 'civicrm_financial_type',
247 'labelColumn' => 'name',
251 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
253 return Civi
::$statics[__CLASS__
]['fields'];
257 * Return a mapping from field-name to the corresponding key (as used in fields()).
260 * Array(string $name => string $uniqueName).
262 public static function &fieldKeys() {
263 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
264 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
266 return Civi
::$statics[__CLASS__
]['fieldKeys'];
270 * Returns the names of this table
274 public static function getTableName() {
275 return self
::$_tableName;
279 * Returns if this table needs to be logged
283 public function getLog() {
288 * Returns the list of fields that can be imported
290 * @param bool $prefix
294 public static function &import($prefix = FALSE) {
295 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'contribution_product', $prefix, []);
300 * Returns the list of fields that can be exported
302 * @param bool $prefix
306 public static function &export($prefix = FALSE) {
307 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'contribution_product', $prefix, []);
312 * Returns the list of indices
314 * @param bool $localize
318 public static function indices($localize = TRUE) {
320 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;