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:dd95e7a994c6dfe314f149b5ba7d48db)
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',
143 'name' => 'product_id',
144 'type' => CRM_Utils_Type
::T_INT
,
145 'title' => ts('Product ID'),
147 'where' => 'civicrm_contribution_product.product_id',
148 'table_name' => 'civicrm_contribution_product',
149 'entity' => 'ContributionProduct',
150 'bao' => 'CRM_Contribute_DAO_ContributionProduct',
154 'contribution_id' => [
155 'name' => 'contribution_id',
156 'type' => CRM_Utils_Type
::T_INT
,
157 'title' => ts('Contribution ID'),
159 'where' => 'civicrm_contribution_product.contribution_id',
160 'table_name' => 'civicrm_contribution_product',
161 'entity' => 'ContributionProduct',
162 'bao' => 'CRM_Contribute_DAO_ContributionProduct',
164 'FKClassName' => 'CRM_Contribute_DAO_Contribution',
167 'product_option' => [
168 'name' => 'product_option',
169 'type' => CRM_Utils_Type
::T_STRING
,
170 'title' => ts('Product Option'),
171 'description' => ts('Option value selected if applicable - e.g. color, size etc.'),
173 'size' => CRM_Utils_Type
::HUGE
,
174 'where' => 'civicrm_contribution_product.product_option',
176 'table_name' => 'civicrm_contribution_product',
177 'entity' => 'ContributionProduct',
178 'bao' => 'CRM_Contribute_DAO_ContributionProduct',
183 'name' => 'quantity',
184 'type' => CRM_Utils_Type
::T_INT
,
185 'title' => ts('Quantity'),
186 'where' => 'civicrm_contribution_product.quantity',
188 'table_name' => 'civicrm_contribution_product',
189 'entity' => 'ContributionProduct',
190 'bao' => 'CRM_Contribute_DAO_ContributionProduct',
194 'fulfilled_date' => [
195 'name' => 'fulfilled_date',
196 'type' => CRM_Utils_Type
::T_DATE
,
197 'title' => ts('Fulfilled Date'),
198 'description' => ts('Optional. Can be used to record the date this product was fulfilled or shipped.'),
199 'where' => 'civicrm_contribution_product.fulfilled_date',
201 'table_name' => 'civicrm_contribution_product',
202 'entity' => 'ContributionProduct',
203 'bao' => 'CRM_Contribute_DAO_ContributionProduct',
206 'type' => 'Select Date',
207 'formatType' => 'activityDate',
211 'contribution_start_date' => [
212 'name' => 'start_date',
213 'type' => CRM_Utils_Type
::T_DATE
,
214 'title' => ts('Start date for premium'),
215 'description' => ts('Actual start date for a time-delimited premium (subscription, service or membership)'),
216 'where' => 'civicrm_contribution_product.start_date',
218 'table_name' => 'civicrm_contribution_product',
219 'entity' => 'ContributionProduct',
220 'bao' => 'CRM_Contribute_DAO_ContributionProduct',
224 'contribution_end_date' => [
225 'name' => 'end_date',
226 'type' => CRM_Utils_Type
::T_DATE
,
227 'title' => ts('End date for premium'),
228 'description' => ts('Actual end date for a time-delimited premium (subscription, service or membership)'),
229 'where' => 'civicrm_contribution_product.end_date',
231 'table_name' => 'civicrm_contribution_product',
232 'entity' => 'ContributionProduct',
233 'bao' => 'CRM_Contribute_DAO_ContributionProduct',
239 'type' => CRM_Utils_Type
::T_TEXT
,
240 'title' => ts('Premium comment'),
241 'where' => 'civicrm_contribution_product.comment',
242 'table_name' => 'civicrm_contribution_product',
243 'entity' => 'ContributionProduct',
244 'bao' => 'CRM_Contribute_DAO_ContributionProduct',
248 'financial_type_id' => [
249 'name' => 'financial_type_id',
250 'type' => CRM_Utils_Type
::T_INT
,
251 'title' => ts('Financial Type'),
252 'description' => ts('FK to Financial Type(for membership price sets only).'),
253 'where' => 'civicrm_contribution_product.financial_type_id',
255 'table_name' => 'civicrm_contribution_product',
256 'entity' => 'ContributionProduct',
257 'bao' => 'CRM_Contribute_DAO_ContributionProduct',
259 'FKClassName' => 'CRM_Financial_DAO_FinancialType',
260 'pseudoconstant' => [
261 'table' => 'civicrm_financial_type',
263 'labelColumn' => 'name',
268 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
270 return Civi
::$statics[__CLASS__
]['fields'];
274 * Return a mapping from field-name to the corresponding key (as used in fields()).
277 * Array(string $name => string $uniqueName).
279 public static function &fieldKeys() {
280 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
281 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
283 return Civi
::$statics[__CLASS__
]['fieldKeys'];
287 * Returns the names of this table
291 public static function getTableName() {
292 return self
::$_tableName;
296 * Returns if this table needs to be logged
300 public function getLog() {
305 * Returns the list of fields that can be imported
307 * @param bool $prefix
311 public static function &import($prefix = FALSE) {
312 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'contribution_product', $prefix, []);
317 * Returns the list of fields that can be exported
319 * @param bool $prefix
323 public static function &export($prefix = FALSE) {
324 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'contribution_product', $prefix, []);
329 * Returns the list of indices
331 * @param bool $localize
335 public static function indices($localize = TRUE) {
337 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;