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:4831cb4c7e0611db0f4312f6522d2c20)
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';
20 * Static instance to hold the table name.
24 public static $_tableName = 'civicrm_premiums_product';
27 * Should CiviCRM log any modifications to this table in the civicrm_log table.
31 public static $_log = TRUE;
41 * Foreign key to premiums settings record.
48 * Foreign key to each product object.
60 * FK to Financial Type.
64 public $financial_type_id;
69 public function __construct() {
70 $this->__table
= 'civicrm_premiums_product';
71 parent
::__construct();
75 * Returns localized title of this entity.
77 public static function getEntityTitle() {
78 return ts('Premiums Products');
82 * Returns foreign keys and entity references.
85 * [CRM_Core_Reference_Interface]
87 public static function getReferenceColumns() {
88 if (!isset(Civi
::$statics[__CLASS__
]['links'])) {
89 Civi
::$statics[__CLASS__
]['links'] = static::createReferenceColumns(__CLASS__
);
90 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'premiums_id', 'civicrm_premiums', 'id');
91 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'product_id', 'civicrm_product', 'id');
92 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'financial_type_id', 'civicrm_financial_type', 'id');
93 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'links_callback', Civi
::$statics[__CLASS__
]['links']);
95 return Civi
::$statics[__CLASS__
]['links'];
99 * Returns all the column names of this table
103 public static function &fields() {
104 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
105 Civi
::$statics[__CLASS__
]['fields'] = [
108 'type' => CRM_Utils_Type
::T_INT
,
109 'title' => ts('Premium Product ID'),
110 'description' => ts('Contribution ID'),
112 'where' => 'civicrm_premiums_product.id',
113 'table_name' => 'civicrm_premiums_product',
114 'entity' => 'PremiumsProduct',
115 'bao' => 'CRM_Contribute_DAO_PremiumsProduct',
120 'name' => 'premiums_id',
121 'type' => CRM_Utils_Type
::T_INT
,
122 'title' => ts('Premium'),
123 'description' => ts('Foreign key to premiums settings record.'),
125 'where' => 'civicrm_premiums_product.premiums_id',
126 'table_name' => 'civicrm_premiums_product',
127 'entity' => 'PremiumsProduct',
128 'bao' => 'CRM_Contribute_DAO_PremiumsProduct',
130 'FKClassName' => 'CRM_Contribute_DAO_Premium',
134 'name' => 'product_id',
135 'type' => CRM_Utils_Type
::T_INT
,
136 'title' => ts('Product'),
137 'description' => ts('Foreign key to each product object.'),
139 'where' => 'civicrm_premiums_product.product_id',
140 'table_name' => 'civicrm_premiums_product',
141 'entity' => 'PremiumsProduct',
142 'bao' => 'CRM_Contribute_DAO_PremiumsProduct',
144 'FKClassName' => 'CRM_Contribute_DAO_Product',
149 'type' => CRM_Utils_Type
::T_INT
,
150 'title' => ts('Order'),
152 'where' => 'civicrm_premiums_product.weight',
153 'table_name' => 'civicrm_premiums_product',
154 'entity' => 'PremiumsProduct',
155 'bao' => 'CRM_Contribute_DAO_PremiumsProduct',
159 'financial_type_id' => [
160 'name' => 'financial_type_id',
161 'type' => CRM_Utils_Type
::T_INT
,
162 'title' => ts('Financial Type'),
163 'description' => ts('FK to Financial Type.'),
164 'where' => 'civicrm_premiums_product.financial_type_id',
166 'table_name' => 'civicrm_premiums_product',
167 'entity' => 'PremiumsProduct',
168 'bao' => 'CRM_Contribute_DAO_PremiumsProduct',
170 'FKClassName' => 'CRM_Financial_DAO_FinancialType',
171 'pseudoconstant' => [
172 'table' => 'civicrm_financial_type',
174 'labelColumn' => 'name',
179 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
181 return Civi
::$statics[__CLASS__
]['fields'];
185 * Return a mapping from field-name to the corresponding key (as used in fields()).
188 * Array(string $name => string $uniqueName).
190 public static function &fieldKeys() {
191 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
192 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
194 return Civi
::$statics[__CLASS__
]['fieldKeys'];
198 * Returns the names of this table
202 public static function getTableName() {
203 return self
::$_tableName;
207 * Returns if this table needs to be logged
211 public function getLog() {
216 * Returns the list of fields that can be imported
218 * @param bool $prefix
222 public static function &import($prefix = FALSE) {
223 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'premiums_product', $prefix, []);
228 * Returns the list of fields that can be exported
230 * @param bool $prefix
234 public static function &export($prefix = FALSE) {
235 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'premiums_product', $prefix, []);
240 * Returns the list of indices
242 * @param bool $localize
246 public static function indices($localize = TRUE) {
248 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;