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:55d9ad3d7acb1129577589352f6010cd)
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;
35 * @var int|string|null
36 * (SQL type: int unsigned)
37 * Note that values will be retrieved from the database as a string.
43 * (SQL type: int unsigned)
44 * Note that values will be retrieved from the database as a string.
50 * (SQL type: int unsigned)
51 * Note that values will be retrieved from the database as a string.
53 public $contribution_id;
56 * Option value selected if applicable - e.g. color, size etc.
59 * (SQL type: varchar(255))
60 * Note that values will be retrieved from the database as a string.
62 public $product_option;
65 * @var int|string|null
67 * Note that values will be retrieved from the database as a string.
72 * Optional. Can be used to record the date this product was fulfilled or shipped.
76 * Note that values will be retrieved from the database as a string.
78 public $fulfilled_date;
81 * Actual start date for a time-delimited premium (subscription, service or membership)
85 * Note that values will be retrieved from the database as a string.
90 * Actual end date for a time-delimited premium (subscription, service or membership)
94 * Note that values will be retrieved from the database as a string.
101 * Note that values will be retrieved from the database as a string.
106 * FK to Financial Type(for membership price sets only).
108 * @var int|string|null
109 * (SQL type: int unsigned)
110 * Note that values will be retrieved from the database as a string.
112 public $financial_type_id;
117 public function __construct() {
118 $this->__table
= 'civicrm_contribution_product';
119 parent
::__construct();
123 * Returns localized title of this entity.
125 * @param bool $plural
126 * Whether to return the plural version of the title.
128 public static function getEntityTitle($plural = FALSE) {
129 return $plural ?
ts('Contribution Products') : ts('Contribution Product');
133 * Returns foreign keys and entity references.
136 * [CRM_Core_Reference_Interface]
138 public static function getReferenceColumns() {
139 if (!isset(Civi
::$statics[__CLASS__
]['links'])) {
140 Civi
::$statics[__CLASS__
]['links'] = static::createReferenceColumns(__CLASS__
);
141 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'product_id', 'civicrm_product', 'id');
142 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'contribution_id', 'civicrm_contribution', 'id');
143 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'financial_type_id', 'civicrm_financial_type', 'id');
144 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'links_callback', Civi
::$statics[__CLASS__
]['links']);
146 return Civi
::$statics[__CLASS__
]['links'];
150 * Returns all the column names of this table
154 public static function &fields() {
155 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
156 Civi
::$statics[__CLASS__
]['fields'] = [
159 'type' => CRM_Utils_Type
::T_INT
,
160 'title' => ts('Contribution Product ID'),
162 'where' => 'civicrm_contribution_product.id',
163 'table_name' => 'civicrm_contribution_product',
164 'entity' => 'ContributionProduct',
165 'bao' => 'CRM_Contribute_DAO_ContributionProduct',
174 'name' => 'product_id',
175 'type' => CRM_Utils_Type
::T_INT
,
176 'title' => ts('Product ID'),
178 'where' => 'civicrm_contribution_product.product_id',
179 'table_name' => 'civicrm_contribution_product',
180 'entity' => 'ContributionProduct',
181 'bao' => 'CRM_Contribute_DAO_ContributionProduct',
183 'FKClassName' => 'CRM_Contribute_DAO_Product',
186 'contribution_id' => [
187 'name' => 'contribution_id',
188 'type' => CRM_Utils_Type
::T_INT
,
189 'title' => ts('Contribution ID'),
191 'where' => 'civicrm_contribution_product.contribution_id',
192 'table_name' => 'civicrm_contribution_product',
193 'entity' => 'ContributionProduct',
194 'bao' => 'CRM_Contribute_DAO_ContributionProduct',
196 'FKClassName' => 'CRM_Contribute_DAO_Contribution',
198 'label' => ts("Contribution"),
202 'product_option' => [
203 'name' => 'product_option',
204 'type' => CRM_Utils_Type
::T_STRING
,
205 'title' => ts('Product Option'),
206 'description' => ts('Option value selected if applicable - e.g. color, size etc.'),
208 'size' => CRM_Utils_Type
::HUGE
,
209 'where' => 'civicrm_contribution_product.product_option',
211 'table_name' => 'civicrm_contribution_product',
212 'entity' => 'ContributionProduct',
213 'bao' => 'CRM_Contribute_DAO_ContributionProduct',
218 'name' => 'quantity',
219 'type' => CRM_Utils_Type
::T_INT
,
220 'title' => ts('Quantity'),
221 'where' => 'civicrm_contribution_product.quantity',
223 'table_name' => 'civicrm_contribution_product',
224 'entity' => 'ContributionProduct',
225 'bao' => 'CRM_Contribute_DAO_ContributionProduct',
229 'fulfilled_date' => [
230 'name' => 'fulfilled_date',
231 'type' => CRM_Utils_Type
::T_DATE
,
232 'title' => ts('Fulfilled Date'),
233 'description' => ts('Optional. Can be used to record the date this product was fulfilled or shipped.'),
234 'where' => 'civicrm_contribution_product.fulfilled_date',
236 'table_name' => 'civicrm_contribution_product',
237 'entity' => 'ContributionProduct',
238 'bao' => 'CRM_Contribute_DAO_ContributionProduct',
241 'type' => 'Select Date',
242 'formatType' => 'activityDate',
246 'contribution_start_date' => [
247 'name' => 'start_date',
248 'type' => CRM_Utils_Type
::T_DATE
,
249 'title' => ts('Start date for premium'),
250 'description' => ts('Actual start date for a time-delimited premium (subscription, service or membership)'),
251 'where' => 'civicrm_contribution_product.start_date',
253 'table_name' => 'civicrm_contribution_product',
254 'entity' => 'ContributionProduct',
255 'bao' => 'CRM_Contribute_DAO_ContributionProduct',
259 'contribution_end_date' => [
260 'name' => 'end_date',
261 'type' => CRM_Utils_Type
::T_DATE
,
262 'title' => ts('End date for premium'),
263 'description' => ts('Actual end date for a time-delimited premium (subscription, service or membership)'),
264 'where' => 'civicrm_contribution_product.end_date',
266 'table_name' => 'civicrm_contribution_product',
267 'entity' => 'ContributionProduct',
268 'bao' => 'CRM_Contribute_DAO_ContributionProduct',
274 'type' => CRM_Utils_Type
::T_TEXT
,
275 'title' => ts('Premium comment'),
276 'where' => 'civicrm_contribution_product.comment',
277 'table_name' => 'civicrm_contribution_product',
278 'entity' => 'ContributionProduct',
279 'bao' => 'CRM_Contribute_DAO_ContributionProduct',
283 'financial_type_id' => [
284 'name' => 'financial_type_id',
285 'type' => CRM_Utils_Type
::T_INT
,
286 'title' => ts('Financial Type ID'),
287 'description' => ts('FK to Financial Type(for membership price sets only).'),
288 'where' => 'civicrm_contribution_product.financial_type_id',
290 'table_name' => 'civicrm_contribution_product',
291 'entity' => 'ContributionProduct',
292 'bao' => 'CRM_Contribute_DAO_ContributionProduct',
294 'FKClassName' => 'CRM_Financial_DAO_FinancialType',
296 'label' => ts("Financial Type"),
298 'pseudoconstant' => [
299 'table' => 'civicrm_financial_type',
301 'labelColumn' => 'name',
306 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
308 return Civi
::$statics[__CLASS__
]['fields'];
312 * Return a mapping from field-name to the corresponding key (as used in fields()).
315 * Array(string $name => string $uniqueName).
317 public static function &fieldKeys() {
318 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
319 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
321 return Civi
::$statics[__CLASS__
]['fieldKeys'];
325 * Returns the names of this table
329 public static function getTableName() {
330 return self
::$_tableName;
334 * Returns if this table needs to be logged
338 public function getLog() {
343 * Returns the list of fields that can be imported
345 * @param bool $prefix
349 public static function &import($prefix = FALSE) {
350 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'contribution_product', $prefix, []);
355 * Returns the list of fields that can be exported
357 * @param bool $prefix
361 public static function &export($prefix = FALSE) {
362 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'contribution_product', $prefix, []);
367 * Returns the list of indices
369 * @param bool $localize
373 public static function indices($localize = TRUE) {
375 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;