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:b8b2fd54470db337ec6285ac53bc51b1)
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(), 'product_id', 'civicrm_product', 'id');
122 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'contribution_id', 'civicrm_contribution', 'id');
123 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'financial_type_id', 'civicrm_financial_type', 'id');
124 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'links_callback', Civi
::$statics[__CLASS__
]['links']);
126 return Civi
::$statics[__CLASS__
]['links'];
130 * Returns all the column names of this table
134 public static function &fields() {
135 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
136 Civi
::$statics[__CLASS__
]['fields'] = [
139 'type' => CRM_Utils_Type
::T_INT
,
140 'title' => ts('Contribution Product ID'),
142 'where' => 'civicrm_contribution_product.id',
143 'table_name' => 'civicrm_contribution_product',
144 'entity' => 'ContributionProduct',
145 'bao' => 'CRM_Contribute_DAO_ContributionProduct',
154 'name' => 'product_id',
155 'type' => CRM_Utils_Type
::T_INT
,
156 'title' => ts('Product ID'),
158 'where' => 'civicrm_contribution_product.product_id',
159 'table_name' => 'civicrm_contribution_product',
160 'entity' => 'ContributionProduct',
161 'bao' => 'CRM_Contribute_DAO_ContributionProduct',
163 'FKClassName' => 'CRM_Contribute_DAO_Product',
166 'contribution_id' => [
167 'name' => 'contribution_id',
168 'type' => CRM_Utils_Type
::T_INT
,
169 'title' => ts('Contribution ID'),
171 'where' => 'civicrm_contribution_product.contribution_id',
172 'table_name' => 'civicrm_contribution_product',
173 'entity' => 'ContributionProduct',
174 'bao' => 'CRM_Contribute_DAO_ContributionProduct',
176 'FKClassName' => 'CRM_Contribute_DAO_Contribution',
178 'label' => ts("Contribution"),
182 'product_option' => [
183 'name' => 'product_option',
184 'type' => CRM_Utils_Type
::T_STRING
,
185 'title' => ts('Product Option'),
186 'description' => ts('Option value selected if applicable - e.g. color, size etc.'),
188 'size' => CRM_Utils_Type
::HUGE
,
189 'where' => 'civicrm_contribution_product.product_option',
191 'table_name' => 'civicrm_contribution_product',
192 'entity' => 'ContributionProduct',
193 'bao' => 'CRM_Contribute_DAO_ContributionProduct',
198 'name' => 'quantity',
199 'type' => CRM_Utils_Type
::T_INT
,
200 'title' => ts('Quantity'),
201 'where' => 'civicrm_contribution_product.quantity',
203 'table_name' => 'civicrm_contribution_product',
204 'entity' => 'ContributionProduct',
205 'bao' => 'CRM_Contribute_DAO_ContributionProduct',
209 'fulfilled_date' => [
210 'name' => 'fulfilled_date',
211 'type' => CRM_Utils_Type
::T_DATE
,
212 'title' => ts('Fulfilled Date'),
213 'description' => ts('Optional. Can be used to record the date this product was fulfilled or shipped.'),
214 'where' => 'civicrm_contribution_product.fulfilled_date',
216 'table_name' => 'civicrm_contribution_product',
217 'entity' => 'ContributionProduct',
218 'bao' => 'CRM_Contribute_DAO_ContributionProduct',
221 'type' => 'Select Date',
222 'formatType' => 'activityDate',
226 'contribution_start_date' => [
227 'name' => 'start_date',
228 'type' => CRM_Utils_Type
::T_DATE
,
229 'title' => ts('Start date for premium'),
230 'description' => ts('Actual start date for a time-delimited premium (subscription, service or membership)'),
231 'where' => 'civicrm_contribution_product.start_date',
233 'table_name' => 'civicrm_contribution_product',
234 'entity' => 'ContributionProduct',
235 'bao' => 'CRM_Contribute_DAO_ContributionProduct',
239 'contribution_end_date' => [
240 'name' => 'end_date',
241 'type' => CRM_Utils_Type
::T_DATE
,
242 'title' => ts('End date for premium'),
243 'description' => ts('Actual end date for a time-delimited premium (subscription, service or membership)'),
244 'where' => 'civicrm_contribution_product.end_date',
246 'table_name' => 'civicrm_contribution_product',
247 'entity' => 'ContributionProduct',
248 'bao' => 'CRM_Contribute_DAO_ContributionProduct',
254 'type' => CRM_Utils_Type
::T_TEXT
,
255 'title' => ts('Premium comment'),
256 'where' => 'civicrm_contribution_product.comment',
257 'table_name' => 'civicrm_contribution_product',
258 'entity' => 'ContributionProduct',
259 'bao' => 'CRM_Contribute_DAO_ContributionProduct',
263 'financial_type_id' => [
264 'name' => 'financial_type_id',
265 'type' => CRM_Utils_Type
::T_INT
,
266 'title' => ts('Financial Type ID'),
267 'description' => ts('FK to Financial Type(for membership price sets only).'),
268 'where' => 'civicrm_contribution_product.financial_type_id',
270 'table_name' => 'civicrm_contribution_product',
271 'entity' => 'ContributionProduct',
272 'bao' => 'CRM_Contribute_DAO_ContributionProduct',
274 'FKClassName' => 'CRM_Financial_DAO_FinancialType',
276 'label' => ts("Financial Type"),
278 'pseudoconstant' => [
279 'table' => 'civicrm_financial_type',
281 'labelColumn' => 'name',
286 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
288 return Civi
::$statics[__CLASS__
]['fields'];
292 * Return a mapping from field-name to the corresponding key (as used in fields()).
295 * Array(string $name => string $uniqueName).
297 public static function &fieldKeys() {
298 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
299 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
301 return Civi
::$statics[__CLASS__
]['fieldKeys'];
305 * Returns the names of this table
309 public static function getTableName() {
310 return self
::$_tableName;
314 * Returns if this table needs to be logged
318 public function getLog() {
323 * Returns the list of fields that can be imported
325 * @param bool $prefix
329 public static function &import($prefix = FALSE) {
330 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'contribution_product', $prefix, []);
335 * Returns the list of fields that can be exported
337 * @param bool $prefix
341 public static function &export($prefix = FALSE) {
342 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'contribution_product', $prefix, []);
347 * Returns the list of indices
349 * @param bool $localize
353 public static function indices($localize = TRUE) {
355 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;