5 * @copyright CiviCRM LLC https://civicrm.org/licensing
7 * Generated from xml/schema/CRM/Contribute/PremiumsProduct.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:e0f6b18be4eda69e76c5e2242893e133)
13 * Database access object for the PremiumsProduct entity.
15 class CRM_Contribute_DAO_PremiumsProduct
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_premiums_product';
28 * Should CiviCRM log any modifications to this table in the civicrm_log table.
32 public static $_log = TRUE;
42 * Foreign key to premiums settings record.
49 * Foreign key to each product object.
61 * FK to Financial Type.
65 public $financial_type_id;
70 public function __construct() {
71 $this->__table
= 'civicrm_premiums_product';
72 parent
::__construct();
76 * Returns localized title of this entity.
79 * Whether to return the plural version of the title.
81 public static function getEntityTitle($plural = FALSE) {
82 return $plural ?
ts('Product Premiums') : ts('Product Premium');
86 * Returns foreign keys and entity references.
89 * [CRM_Core_Reference_Interface]
91 public static function getReferenceColumns() {
92 if (!isset(Civi
::$statics[__CLASS__
]['links'])) {
93 Civi
::$statics[__CLASS__
]['links'] = static::createReferenceColumns(__CLASS__
);
94 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'premiums_id', 'civicrm_premiums', 'id');
95 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'product_id', 'civicrm_product', 'id');
96 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'financial_type_id', 'civicrm_financial_type', 'id');
97 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'links_callback', Civi
::$statics[__CLASS__
]['links']);
99 return Civi
::$statics[__CLASS__
]['links'];
103 * Returns all the column names of this table
107 public static function &fields() {
108 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
109 Civi
::$statics[__CLASS__
]['fields'] = [
112 'type' => CRM_Utils_Type
::T_INT
,
113 'title' => ts('Premium Product ID'),
114 'description' => ts('Contribution ID'),
116 'where' => 'civicrm_premiums_product.id',
117 'table_name' => 'civicrm_premiums_product',
118 'entity' => 'PremiumsProduct',
119 'bao' => 'CRM_Contribute_DAO_PremiumsProduct',
124 'name' => 'premiums_id',
125 'type' => CRM_Utils_Type
::T_INT
,
126 'title' => ts('Premium'),
127 'description' => ts('Foreign key to premiums settings record.'),
129 'where' => 'civicrm_premiums_product.premiums_id',
130 'table_name' => 'civicrm_premiums_product',
131 'entity' => 'PremiumsProduct',
132 'bao' => 'CRM_Contribute_DAO_PremiumsProduct',
134 'FKClassName' => 'CRM_Contribute_DAO_Premium',
138 'name' => 'product_id',
139 'type' => CRM_Utils_Type
::T_INT
,
140 'title' => ts('Product'),
141 'description' => ts('Foreign key to each product object.'),
143 'where' => 'civicrm_premiums_product.product_id',
144 'table_name' => 'civicrm_premiums_product',
145 'entity' => 'PremiumsProduct',
146 'bao' => 'CRM_Contribute_DAO_PremiumsProduct',
148 'FKClassName' => 'CRM_Contribute_DAO_Product',
153 'type' => CRM_Utils_Type
::T_INT
,
154 'title' => ts('Order'),
156 'where' => 'civicrm_premiums_product.weight',
157 'table_name' => 'civicrm_premiums_product',
158 'entity' => 'PremiumsProduct',
159 'bao' => 'CRM_Contribute_DAO_PremiumsProduct',
163 'financial_type_id' => [
164 'name' => 'financial_type_id',
165 'type' => CRM_Utils_Type
::T_INT
,
166 'title' => ts('Financial Type'),
167 'description' => ts('FK to Financial Type.'),
168 'where' => 'civicrm_premiums_product.financial_type_id',
170 'table_name' => 'civicrm_premiums_product',
171 'entity' => 'PremiumsProduct',
172 'bao' => 'CRM_Contribute_DAO_PremiumsProduct',
174 'FKClassName' => 'CRM_Financial_DAO_FinancialType',
175 'pseudoconstant' => [
176 'table' => 'civicrm_financial_type',
178 'labelColumn' => 'name',
183 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
185 return Civi
::$statics[__CLASS__
]['fields'];
189 * Return a mapping from field-name to the corresponding key (as used in fields()).
192 * Array(string $name => string $uniqueName).
194 public static function &fieldKeys() {
195 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
196 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
198 return Civi
::$statics[__CLASS__
]['fieldKeys'];
202 * Returns the names of this table
206 public static function getTableName() {
207 return self
::$_tableName;
211 * Returns if this table needs to be logged
215 public function getLog() {
220 * Returns the list of fields that can be imported
222 * @param bool $prefix
226 public static function &import($prefix = FALSE) {
227 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'premiums_product', $prefix, []);
232 * Returns the list of fields that can be exported
234 * @param bool $prefix
238 public static function &export($prefix = FALSE) {
239 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'premiums_product', $prefix, []);
244 * Returns the list of indices
246 * @param bool $localize
250 public static function indices($localize = TRUE) {
252 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;