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:1e606c951b384dc261c2980784a04891)
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';
18 const COMPONENT
= 'CiviContribute';
21 * Static instance to hold the table name.
25 public static $_tableName = 'civicrm_contribution_product';
28 * Should CiviCRM log any modifications to this table in the civicrm_log table.
32 public static $_log = TRUE;
47 public $contribution_id;
50 * Option value selected if applicable - e.g. color, size etc.
54 public $product_option;
62 * Optional. Can be used to record the date this product was fulfilled or shipped.
66 public $fulfilled_date;
69 * Actual start date for a time-delimited premium (subscription, service or membership)
76 * Actual end date for a time-delimited premium (subscription, service or membership)
88 * FK to Financial Type(for membership price sets only).
92 public $financial_type_id;
97 public function __construct() {
98 $this->__table
= 'civicrm_contribution_product';
99 parent
::__construct();
103 * Returns localized title of this entity.
105 * @param bool $plural
106 * Whether to return the plural version of the title.
108 public static function getEntityTitle($plural = FALSE) {
109 return $plural ?
ts('Contribution Products') : ts('Contribution Product');
113 * Returns foreign keys and entity references.
116 * [CRM_Core_Reference_Interface]
118 public static function getReferenceColumns() {
119 if (!isset(Civi
::$statics[__CLASS__
]['links'])) {
120 Civi
::$statics[__CLASS__
]['links'] = static::createReferenceColumns(__CLASS__
);
121 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'contribution_id', 'civicrm_contribution', 'id');
122 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'financial_type_id', 'civicrm_financial_type', 'id');
123 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'links_callback', Civi
::$statics[__CLASS__
]['links']);
125 return Civi
::$statics[__CLASS__
]['links'];
129 * Returns all the column names of this table
133 public static function &fields() {
134 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
135 Civi
::$statics[__CLASS__
]['fields'] = [
138 'type' => CRM_Utils_Type
::T_INT
,
139 'title' => ts('Contribution Product ID'),
141 'where' => 'civicrm_contribution_product.id',
142 'table_name' => 'civicrm_contribution_product',
143 'entity' => 'ContributionProduct',
144 'bao' => 'CRM_Contribute_DAO_ContributionProduct',
153 'name' => 'product_id',
154 'type' => CRM_Utils_Type
::T_INT
,
155 'title' => ts('Product ID'),
157 'where' => 'civicrm_contribution_product.product_id',
158 'table_name' => 'civicrm_contribution_product',
159 'entity' => 'ContributionProduct',
160 'bao' => 'CRM_Contribute_DAO_ContributionProduct',
164 'contribution_id' => [
165 'name' => 'contribution_id',
166 'type' => CRM_Utils_Type
::T_INT
,
167 'title' => ts('Contribution ID'),
169 'where' => 'civicrm_contribution_product.contribution_id',
170 'table_name' => 'civicrm_contribution_product',
171 'entity' => 'ContributionProduct',
172 'bao' => 'CRM_Contribute_DAO_ContributionProduct',
174 'FKClassName' => 'CRM_Contribute_DAO_Contribution',
176 'label' => ts("Contribution"),
180 'product_option' => [
181 'name' => 'product_option',
182 'type' => CRM_Utils_Type
::T_STRING
,
183 'title' => ts('Product Option'),
184 'description' => ts('Option value selected if applicable - e.g. color, size etc.'),
186 'size' => CRM_Utils_Type
::HUGE
,
187 'where' => 'civicrm_contribution_product.product_option',
189 'table_name' => 'civicrm_contribution_product',
190 'entity' => 'ContributionProduct',
191 'bao' => 'CRM_Contribute_DAO_ContributionProduct',
196 'name' => 'quantity',
197 'type' => CRM_Utils_Type
::T_INT
,
198 'title' => ts('Quantity'),
199 'where' => 'civicrm_contribution_product.quantity',
201 'table_name' => 'civicrm_contribution_product',
202 'entity' => 'ContributionProduct',
203 'bao' => 'CRM_Contribute_DAO_ContributionProduct',
207 'fulfilled_date' => [
208 'name' => 'fulfilled_date',
209 'type' => CRM_Utils_Type
::T_DATE
,
210 'title' => ts('Fulfilled Date'),
211 'description' => ts('Optional. Can be used to record the date this product was fulfilled or shipped.'),
212 'where' => 'civicrm_contribution_product.fulfilled_date',
214 'table_name' => 'civicrm_contribution_product',
215 'entity' => 'ContributionProduct',
216 'bao' => 'CRM_Contribute_DAO_ContributionProduct',
219 'type' => 'Select Date',
220 'formatType' => 'activityDate',
224 'contribution_start_date' => [
225 'name' => 'start_date',
226 'type' => CRM_Utils_Type
::T_DATE
,
227 'title' => ts('Start date for premium'),
228 'description' => ts('Actual start date for a time-delimited premium (subscription, service or membership)'),
229 'where' => 'civicrm_contribution_product.start_date',
231 'table_name' => 'civicrm_contribution_product',
232 'entity' => 'ContributionProduct',
233 'bao' => 'CRM_Contribute_DAO_ContributionProduct',
237 'contribution_end_date' => [
238 'name' => 'end_date',
239 'type' => CRM_Utils_Type
::T_DATE
,
240 'title' => ts('End date for premium'),
241 'description' => ts('Actual end date for a time-delimited premium (subscription, service or membership)'),
242 'where' => 'civicrm_contribution_product.end_date',
244 'table_name' => 'civicrm_contribution_product',
245 'entity' => 'ContributionProduct',
246 'bao' => 'CRM_Contribute_DAO_ContributionProduct',
252 'type' => CRM_Utils_Type
::T_TEXT
,
253 'title' => ts('Premium comment'),
254 'where' => 'civicrm_contribution_product.comment',
255 'table_name' => 'civicrm_contribution_product',
256 'entity' => 'ContributionProduct',
257 'bao' => 'CRM_Contribute_DAO_ContributionProduct',
261 'financial_type_id' => [
262 'name' => 'financial_type_id',
263 'type' => CRM_Utils_Type
::T_INT
,
264 'title' => ts('Financial Type ID'),
265 'description' => ts('FK to Financial Type(for membership price sets only).'),
266 'where' => 'civicrm_contribution_product.financial_type_id',
268 'table_name' => 'civicrm_contribution_product',
269 'entity' => 'ContributionProduct',
270 'bao' => 'CRM_Contribute_DAO_ContributionProduct',
272 'FKClassName' => 'CRM_Financial_DAO_FinancialType',
274 'label' => ts("Financial Type"),
276 'pseudoconstant' => [
277 'table' => 'civicrm_financial_type',
279 'labelColumn' => 'name',
284 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
286 return Civi
::$statics[__CLASS__
]['fields'];
290 * Return a mapping from field-name to the corresponding key (as used in fields()).
293 * Array(string $name => string $uniqueName).
295 public static function &fieldKeys() {
296 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
297 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
299 return Civi
::$statics[__CLASS__
]['fieldKeys'];
303 * Returns the names of this table
307 public static function getTableName() {
308 return self
::$_tableName;
312 * Returns if this table needs to be logged
316 public function getLog() {
321 * Returns the list of fields that can be imported
323 * @param bool $prefix
327 public static function &import($prefix = FALSE) {
328 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'contribution_product', $prefix, []);
333 * Returns the list of fields that can be exported
335 * @param bool $prefix
339 public static function &export($prefix = FALSE) {
340 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'contribution_product', $prefix, []);
345 * Returns the list of indices
347 * @param bool $localize
351 public static function indices($localize = TRUE) {
353 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;