5 * @copyright CiviCRM LLC (c) 2004-2018
7 * Generated from xml/schema/CRM/Contribute/ContributionProduct.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:8ef29c5c92b3ffb2a678bd4c585a3d0e)
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 static $_tableName = 'civicrm_contribution_product';
25 * Should CiviCRM log any modifications to this table in the civicrm_log table.
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 foreign keys and entity references.
103 * [CRM_Core_Reference_Interface]
105 public static function getReferenceColumns() {
106 if (!isset(Civi
::$statics[__CLASS__
]['links'])) {
107 Civi
::$statics[__CLASS__
]['links'] = static ::createReferenceColumns(__CLASS__
);
108 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'contribution_id', 'civicrm_contribution', 'id');
109 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'financial_type_id', 'civicrm_financial_type', 'id');
110 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'links_callback', Civi
::$statics[__CLASS__
]['links']);
112 return Civi
::$statics[__CLASS__
]['links'];
116 * Returns all the column names of this table
120 public static function &fields() {
121 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
122 Civi
::$statics[__CLASS__
]['fields'] = [
125 'type' => CRM_Utils_Type
::T_INT
,
126 'title' => ts('Contribution Product ID'),
128 'table_name' => 'civicrm_contribution_product',
129 'entity' => 'ContributionProduct',
130 'bao' => 'CRM_Contribute_DAO_ContributionProduct',
134 'name' => 'product_id',
135 'type' => CRM_Utils_Type
::T_INT
,
136 'title' => ts('Product ID'),
138 'table_name' => 'civicrm_contribution_product',
139 'entity' => 'ContributionProduct',
140 'bao' => 'CRM_Contribute_DAO_ContributionProduct',
143 'contribution_id' => [
144 'name' => 'contribution_id',
145 'type' => CRM_Utils_Type
::T_INT
,
146 'title' => ts('Contribution ID'),
148 'table_name' => 'civicrm_contribution_product',
149 'entity' => 'ContributionProduct',
150 'bao' => 'CRM_Contribute_DAO_ContributionProduct',
152 'FKClassName' => 'CRM_Contribute_DAO_Contribution',
154 'product_option' => [
155 'name' => 'product_option',
156 'type' => CRM_Utils_Type
::T_STRING
,
157 'title' => ts('Product Option'),
158 'description' => 'Option value selected if applicable - e.g. color, size etc.',
160 'size' => CRM_Utils_Type
::HUGE
,
162 'where' => 'civicrm_contribution_product.product_option',
163 'headerPattern' => '',
165 'table_name' => 'civicrm_contribution_product',
166 'entity' => 'ContributionProduct',
167 'bao' => 'CRM_Contribute_DAO_ContributionProduct',
171 'name' => 'quantity',
172 'type' => CRM_Utils_Type
::T_INT
,
173 'title' => ts('Quantity'),
175 'where' => 'civicrm_contribution_product.quantity',
176 'headerPattern' => '',
178 'table_name' => 'civicrm_contribution_product',
179 'entity' => 'ContributionProduct',
180 'bao' => 'CRM_Contribute_DAO_ContributionProduct',
183 'fulfilled_date' => [
184 'name' => 'fulfilled_date',
185 'type' => CRM_Utils_Type
::T_DATE
,
186 'title' => ts('Fulfilled Date'),
187 'description' => 'Optional. Can be used to record the date this product was fulfilled or shipped.',
189 'where' => 'civicrm_contribution_product.fulfilled_date',
190 'headerPattern' => '',
192 'table_name' => 'civicrm_contribution_product',
193 'entity' => 'ContributionProduct',
194 'bao' => 'CRM_Contribute_DAO_ContributionProduct',
197 'contribution_start_date' => [
198 'name' => 'start_date',
199 'type' => CRM_Utils_Type
::T_DATE
,
200 'title' => ts('Start date for premium'),
201 'description' => 'Actual start date for a time-delimited premium (subscription, service or membership)',
203 'where' => 'civicrm_contribution_product.start_date',
204 'headerPattern' => '',
206 'table_name' => 'civicrm_contribution_product',
207 'entity' => 'ContributionProduct',
208 'bao' => 'CRM_Contribute_DAO_ContributionProduct',
211 'contribution_end_date' => [
212 'name' => 'end_date',
213 'type' => CRM_Utils_Type
::T_DATE
,
214 'title' => ts('End date for premium'),
215 'description' => 'Actual end date for a time-delimited premium (subscription, service or membership)',
217 'where' => 'civicrm_contribution_product.end_date',
218 'headerPattern' => '',
220 'table_name' => 'civicrm_contribution_product',
221 'entity' => 'ContributionProduct',
222 'bao' => 'CRM_Contribute_DAO_ContributionProduct',
227 'type' => CRM_Utils_Type
::T_TEXT
,
228 'title' => ts('Premium comment'),
229 'table_name' => 'civicrm_contribution_product',
230 'entity' => 'ContributionProduct',
231 'bao' => 'CRM_Contribute_DAO_ContributionProduct',
234 'financial_type_id' => [
235 'name' => 'financial_type_id',
236 'type' => CRM_Utils_Type
::T_INT
,
237 'title' => ts('Financial Type'),
238 'description' => 'FK to Financial Type(for membership price sets only).',
240 'table_name' => 'civicrm_contribution_product',
241 'entity' => 'ContributionProduct',
242 'bao' => 'CRM_Contribute_DAO_ContributionProduct',
244 'FKClassName' => 'CRM_Financial_DAO_FinancialType',
245 'pseudoconstant' => [
246 'table' => 'civicrm_financial_type',
248 'labelColumn' => 'name',
252 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
254 return Civi
::$statics[__CLASS__
]['fields'];
258 * Return a mapping from field-name to the corresponding key (as used in fields()).
261 * Array(string $name => string $uniqueName).
263 public static function &fieldKeys() {
264 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
265 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
267 return Civi
::$statics[__CLASS__
]['fieldKeys'];
271 * Returns the names of this table
275 public static function getTableName() {
276 return self
::$_tableName;
280 * Returns if this table needs to be logged
284 public function getLog() {
289 * Returns the list of fields that can be imported
291 * @param bool $prefix
295 public static function &import($prefix = FALSE) {
296 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'contribution_product', $prefix, []);
301 * Returns the list of fields that can be exported
303 * @param bool $prefix
307 public static function &export($prefix = FALSE) {
308 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'contribution_product', $prefix, []);
313 * Returns the list of indices
315 * @param bool $localize
319 public static function indices($localize = TRUE) {
321 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;