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:ebb8b8950e36872fffdc5ffcf1fc426f)
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 localized title of this entity.
102 public static function getEntityTitle() {
103 return ts('Contribution Products');
107 * Returns foreign keys and entity references.
110 * [CRM_Core_Reference_Interface]
112 public static function getReferenceColumns() {
113 if (!isset(Civi
::$statics[__CLASS__
]['links'])) {
114 Civi
::$statics[__CLASS__
]['links'] = static::createReferenceColumns(__CLASS__
);
115 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'contribution_id', 'civicrm_contribution', 'id');
116 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'financial_type_id', 'civicrm_financial_type', 'id');
117 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'links_callback', Civi
::$statics[__CLASS__
]['links']);
119 return Civi
::$statics[__CLASS__
]['links'];
123 * Returns all the column names of this table
127 public static function &fields() {
128 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
129 Civi
::$statics[__CLASS__
]['fields'] = [
132 'type' => CRM_Utils_Type
::T_INT
,
133 'title' => ts('Contribution Product ID'),
135 'where' => 'civicrm_contribution_product.id',
136 'table_name' => 'civicrm_contribution_product',
137 'entity' => 'ContributionProduct',
138 'bao' => 'CRM_Contribute_DAO_ContributionProduct',
142 'name' => 'product_id',
143 'type' => CRM_Utils_Type
::T_INT
,
144 'title' => ts('Product ID'),
146 'where' => 'civicrm_contribution_product.product_id',
147 'table_name' => 'civicrm_contribution_product',
148 'entity' => 'ContributionProduct',
149 'bao' => 'CRM_Contribute_DAO_ContributionProduct',
152 'contribution_id' => [
153 'name' => 'contribution_id',
154 'type' => CRM_Utils_Type
::T_INT
,
155 'title' => ts('Contribution ID'),
157 'where' => 'civicrm_contribution_product.contribution_id',
158 'table_name' => 'civicrm_contribution_product',
159 'entity' => 'ContributionProduct',
160 'bao' => 'CRM_Contribute_DAO_ContributionProduct',
162 'FKClassName' => 'CRM_Contribute_DAO_Contribution',
164 'product_option' => [
165 'name' => 'product_option',
166 'type' => CRM_Utils_Type
::T_STRING
,
167 'title' => ts('Product Option'),
168 'description' => ts('Option value selected if applicable - e.g. color, size etc.'),
170 'size' => CRM_Utils_Type
::HUGE
,
171 'where' => 'civicrm_contribution_product.product_option',
173 'table_name' => 'civicrm_contribution_product',
174 'entity' => 'ContributionProduct',
175 'bao' => 'CRM_Contribute_DAO_ContributionProduct',
179 'name' => 'quantity',
180 'type' => CRM_Utils_Type
::T_INT
,
181 'title' => ts('Quantity'),
182 'where' => 'civicrm_contribution_product.quantity',
184 'table_name' => 'civicrm_contribution_product',
185 'entity' => 'ContributionProduct',
186 'bao' => 'CRM_Contribute_DAO_ContributionProduct',
189 'fulfilled_date' => [
190 'name' => 'fulfilled_date',
191 'type' => CRM_Utils_Type
::T_DATE
,
192 'title' => ts('Fulfilled Date'),
193 'description' => ts('Optional. Can be used to record the date this product was fulfilled or shipped.'),
194 'where' => 'civicrm_contribution_product.fulfilled_date',
196 'table_name' => 'civicrm_contribution_product',
197 'entity' => 'ContributionProduct',
198 'bao' => 'CRM_Contribute_DAO_ContributionProduct',
201 'type' => 'Select Date',
202 'formatType' => 'activityDate',
205 'contribution_start_date' => [
206 'name' => 'start_date',
207 'type' => CRM_Utils_Type
::T_DATE
,
208 'title' => ts('Start date for premium'),
209 'description' => ts('Actual start date for a time-delimited premium (subscription, service or membership)'),
210 'where' => 'civicrm_contribution_product.start_date',
212 'table_name' => 'civicrm_contribution_product',
213 'entity' => 'ContributionProduct',
214 'bao' => 'CRM_Contribute_DAO_ContributionProduct',
217 'contribution_end_date' => [
218 'name' => 'end_date',
219 'type' => CRM_Utils_Type
::T_DATE
,
220 'title' => ts('End date for premium'),
221 'description' => ts('Actual end date for a time-delimited premium (subscription, service or membership)'),
222 'where' => 'civicrm_contribution_product.end_date',
224 'table_name' => 'civicrm_contribution_product',
225 'entity' => 'ContributionProduct',
226 'bao' => 'CRM_Contribute_DAO_ContributionProduct',
231 'type' => CRM_Utils_Type
::T_TEXT
,
232 'title' => ts('Premium comment'),
233 'where' => 'civicrm_contribution_product.comment',
234 'table_name' => 'civicrm_contribution_product',
235 'entity' => 'ContributionProduct',
236 'bao' => 'CRM_Contribute_DAO_ContributionProduct',
239 'financial_type_id' => [
240 'name' => 'financial_type_id',
241 'type' => CRM_Utils_Type
::T_INT
,
242 'title' => ts('Financial Type'),
243 'description' => ts('FK to Financial Type(for membership price sets only).'),
244 'where' => 'civicrm_contribution_product.financial_type_id',
246 'table_name' => 'civicrm_contribution_product',
247 'entity' => 'ContributionProduct',
248 'bao' => 'CRM_Contribute_DAO_ContributionProduct',
250 'FKClassName' => 'CRM_Financial_DAO_FinancialType',
251 'pseudoconstant' => [
252 'table' => 'civicrm_financial_type',
254 'labelColumn' => 'name',
258 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
260 return Civi
::$statics[__CLASS__
]['fields'];
264 * Return a mapping from field-name to the corresponding key (as used in fields()).
267 * Array(string $name => string $uniqueName).
269 public static function &fieldKeys() {
270 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
271 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
273 return Civi
::$statics[__CLASS__
]['fieldKeys'];
277 * Returns the names of this table
281 public static function getTableName() {
282 return self
::$_tableName;
286 * Returns if this table needs to be logged
290 public function getLog() {
295 * Returns the list of fields that can be imported
297 * @param bool $prefix
301 public static function &import($prefix = FALSE) {
302 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'contribution_product', $prefix, []);
307 * Returns the list of fields that can be exported
309 * @param bool $prefix
313 public static function &export($prefix = FALSE) {
314 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'contribution_product', $prefix, []);
319 * Returns the list of indices
321 * @param bool $localize
325 public static function indices($localize = TRUE) {
327 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;