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:4e76d9dc75f5bc1b1141645c8ee5e2e4)
13 * Database access object for the ContributionProduct entity.
15 class CRM_Contribute_DAO_ContributionProduct
extends CRM_Core_DAO
{
16 const EXT
= 'civicrm';
17 const TABLE_ADDED
= '1.4';
20 * Static instance to hold the table name.
24 public static $_tableName = 'civicrm_contribution_product';
27 * Should CiviCRM log any modifications to this table in the civicrm_log table.
31 public static $_log = TRUE;
46 public $contribution_id;
49 * Option value selected if applicable - e.g. color, size etc.
53 public $product_option;
61 * Optional. Can be used to record the date this product was fulfilled or shipped.
65 public $fulfilled_date;
68 * Actual start date for a time-delimited premium (subscription, service or membership)
75 * Actual end date for a time-delimited premium (subscription, service or membership)
87 * FK to Financial Type(for membership price sets only).
91 public $financial_type_id;
96 public function __construct() {
97 $this->__table
= 'civicrm_contribution_product';
98 parent
::__construct();
102 * Returns localized title of this entity.
104 public static function getEntityTitle() {
105 return ts('Contribution Products');
109 * Returns foreign keys and entity references.
112 * [CRM_Core_Reference_Interface]
114 public static function getReferenceColumns() {
115 if (!isset(Civi
::$statics[__CLASS__
]['links'])) {
116 Civi
::$statics[__CLASS__
]['links'] = static::createReferenceColumns(__CLASS__
);
117 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'contribution_id', 'civicrm_contribution', 'id');
118 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'financial_type_id', 'civicrm_financial_type', 'id');
119 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'links_callback', Civi
::$statics[__CLASS__
]['links']);
121 return Civi
::$statics[__CLASS__
]['links'];
125 * Returns all the column names of this table
129 public static function &fields() {
130 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
131 Civi
::$statics[__CLASS__
]['fields'] = [
134 'type' => CRM_Utils_Type
::T_INT
,
135 'title' => ts('Contribution Product ID'),
137 'where' => 'civicrm_contribution_product.id',
138 'table_name' => 'civicrm_contribution_product',
139 'entity' => 'ContributionProduct',
140 'bao' => 'CRM_Contribute_DAO_ContributionProduct',
145 'name' => 'product_id',
146 'type' => CRM_Utils_Type
::T_INT
,
147 'title' => ts('Product ID'),
149 'where' => 'civicrm_contribution_product.product_id',
150 'table_name' => 'civicrm_contribution_product',
151 'entity' => 'ContributionProduct',
152 'bao' => 'CRM_Contribute_DAO_ContributionProduct',
156 'contribution_id' => [
157 'name' => 'contribution_id',
158 'type' => CRM_Utils_Type
::T_INT
,
159 'title' => ts('Contribution ID'),
161 'where' => 'civicrm_contribution_product.contribution_id',
162 'table_name' => 'civicrm_contribution_product',
163 'entity' => 'ContributionProduct',
164 'bao' => 'CRM_Contribute_DAO_ContributionProduct',
166 'FKClassName' => 'CRM_Contribute_DAO_Contribution',
169 'product_option' => [
170 'name' => 'product_option',
171 'type' => CRM_Utils_Type
::T_STRING
,
172 'title' => ts('Product Option'),
173 'description' => ts('Option value selected if applicable - e.g. color, size etc.'),
175 'size' => CRM_Utils_Type
::HUGE
,
176 'where' => 'civicrm_contribution_product.product_option',
178 'table_name' => 'civicrm_contribution_product',
179 'entity' => 'ContributionProduct',
180 'bao' => 'CRM_Contribute_DAO_ContributionProduct',
185 'name' => 'quantity',
186 'type' => CRM_Utils_Type
::T_INT
,
187 'title' => ts('Quantity'),
188 'where' => 'civicrm_contribution_product.quantity',
190 'table_name' => 'civicrm_contribution_product',
191 'entity' => 'ContributionProduct',
192 'bao' => 'CRM_Contribute_DAO_ContributionProduct',
196 'fulfilled_date' => [
197 'name' => 'fulfilled_date',
198 'type' => CRM_Utils_Type
::T_DATE
,
199 'title' => ts('Fulfilled Date'),
200 'description' => ts('Optional. Can be used to record the date this product was fulfilled or shipped.'),
201 'where' => 'civicrm_contribution_product.fulfilled_date',
203 'table_name' => 'civicrm_contribution_product',
204 'entity' => 'ContributionProduct',
205 'bao' => 'CRM_Contribute_DAO_ContributionProduct',
208 'type' => 'Select Date',
209 'formatType' => 'activityDate',
213 'contribution_start_date' => [
214 'name' => 'start_date',
215 'type' => CRM_Utils_Type
::T_DATE
,
216 'title' => ts('Start date for premium'),
217 'description' => ts('Actual start date for a time-delimited premium (subscription, service or membership)'),
218 'where' => 'civicrm_contribution_product.start_date',
220 'table_name' => 'civicrm_contribution_product',
221 'entity' => 'ContributionProduct',
222 'bao' => 'CRM_Contribute_DAO_ContributionProduct',
226 'contribution_end_date' => [
227 'name' => 'end_date',
228 'type' => CRM_Utils_Type
::T_DATE
,
229 'title' => ts('End date for premium'),
230 'description' => ts('Actual end date for a time-delimited premium (subscription, service or membership)'),
231 'where' => 'civicrm_contribution_product.end_date',
233 'table_name' => 'civicrm_contribution_product',
234 'entity' => 'ContributionProduct',
235 'bao' => 'CRM_Contribute_DAO_ContributionProduct',
241 'type' => CRM_Utils_Type
::T_TEXT
,
242 'title' => ts('Premium comment'),
243 'where' => 'civicrm_contribution_product.comment',
244 'table_name' => 'civicrm_contribution_product',
245 'entity' => 'ContributionProduct',
246 'bao' => 'CRM_Contribute_DAO_ContributionProduct',
250 'financial_type_id' => [
251 'name' => 'financial_type_id',
252 'type' => CRM_Utils_Type
::T_INT
,
253 'title' => ts('Financial Type'),
254 'description' => ts('FK to Financial Type(for membership price sets only).'),
255 'where' => 'civicrm_contribution_product.financial_type_id',
257 'table_name' => 'civicrm_contribution_product',
258 'entity' => 'ContributionProduct',
259 'bao' => 'CRM_Contribute_DAO_ContributionProduct',
261 'FKClassName' => 'CRM_Financial_DAO_FinancialType',
262 'pseudoconstant' => [
263 'table' => 'civicrm_financial_type',
265 'labelColumn' => 'name',
270 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
272 return Civi
::$statics[__CLASS__
]['fields'];
276 * Return a mapping from field-name to the corresponding key (as used in fields()).
279 * Array(string $name => string $uniqueName).
281 public static function &fieldKeys() {
282 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
283 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
285 return Civi
::$statics[__CLASS__
]['fieldKeys'];
289 * Returns the names of this table
293 public static function getTableName() {
294 return self
::$_tableName;
298 * Returns if this table needs to be logged
302 public function getLog() {
307 * Returns the list of fields that can be imported
309 * @param bool $prefix
313 public static function &import($prefix = FALSE) {
314 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'contribution_product', $prefix, []);
319 * Returns the list of fields that can be exported
321 * @param bool $prefix
325 public static function &export($prefix = FALSE) {
326 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'contribution_product', $prefix, []);
331 * Returns the list of indices
333 * @param bool $localize
337 public static function indices($localize = TRUE) {
339 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;