5 * @copyright CiviCRM LLC (c) 2004-2019
7 * Generated from xml/schema/CRM/Contribute/PremiumsProduct.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:b6944ad257ea16a60d6c1cf79ca391b0)
13 * Database access object for the PremiumsProduct entity.
15 class CRM_Contribute_DAO_PremiumsProduct
extends CRM_Core_DAO
{
18 * Static instance to hold the table name.
22 static $_tableName = 'civicrm_premiums_product';
25 * Should CiviCRM log any modifications to this table in the civicrm_log table.
39 * Foreign key to premiums settings record.
46 * Foreign key to each product object.
58 * FK to Financial Type.
62 public $financial_type_id;
67 public function __construct() {
68 $this->__table
= 'civicrm_premiums_product';
69 parent
::__construct();
73 * Returns foreign keys and entity references.
76 * [CRM_Core_Reference_Interface]
78 public static function getReferenceColumns() {
79 if (!isset(Civi
::$statics[__CLASS__
]['links'])) {
80 Civi
::$statics[__CLASS__
]['links'] = static ::createReferenceColumns(__CLASS__
);
81 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'premiums_id', 'civicrm_premiums', 'id');
82 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'product_id', 'civicrm_product', 'id');
83 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'financial_type_id', 'civicrm_financial_type', 'id');
84 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'links_callback', Civi
::$statics[__CLASS__
]['links']);
86 return Civi
::$statics[__CLASS__
]['links'];
90 * Returns all the column names of this table
94 public static function &fields() {
95 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
96 Civi
::$statics[__CLASS__
]['fields'] = [
99 'type' => CRM_Utils_Type
::T_INT
,
100 'title' => ts('Premium Product ID'),
101 'description' => ts('Contribution ID'),
103 'table_name' => 'civicrm_premiums_product',
104 'entity' => 'PremiumsProduct',
105 'bao' => 'CRM_Contribute_DAO_PremiumsProduct',
109 'name' => 'premiums_id',
110 'type' => CRM_Utils_Type
::T_INT
,
111 'title' => ts('Premium'),
112 'description' => ts('Foreign key to premiums settings record.'),
114 'table_name' => 'civicrm_premiums_product',
115 'entity' => 'PremiumsProduct',
116 'bao' => 'CRM_Contribute_DAO_PremiumsProduct',
118 'FKClassName' => 'CRM_Contribute_DAO_Premium',
121 'name' => 'product_id',
122 'type' => CRM_Utils_Type
::T_INT
,
123 'title' => ts('Product'),
124 'description' => ts('Foreign key to each product object.'),
126 'table_name' => 'civicrm_premiums_product',
127 'entity' => 'PremiumsProduct',
128 'bao' => 'CRM_Contribute_DAO_PremiumsProduct',
130 'FKClassName' => 'CRM_Contribute_DAO_Product',
134 'type' => CRM_Utils_Type
::T_INT
,
135 'title' => ts('Order'),
137 'table_name' => 'civicrm_premiums_product',
138 'entity' => 'PremiumsProduct',
139 'bao' => 'CRM_Contribute_DAO_PremiumsProduct',
142 'financial_type_id' => [
143 'name' => 'financial_type_id',
144 'type' => CRM_Utils_Type
::T_INT
,
145 'title' => ts('Financial Type'),
146 'description' => ts('FK to Financial Type.'),
148 'table_name' => 'civicrm_premiums_product',
149 'entity' => 'PremiumsProduct',
150 'bao' => 'CRM_Contribute_DAO_PremiumsProduct',
152 'FKClassName' => 'CRM_Financial_DAO_FinancialType',
153 'pseudoconstant' => [
154 'table' => 'civicrm_financial_type',
156 'labelColumn' => 'name',
160 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
162 return Civi
::$statics[__CLASS__
]['fields'];
166 * Return a mapping from field-name to the corresponding key (as used in fields()).
169 * Array(string $name => string $uniqueName).
171 public static function &fieldKeys() {
172 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
173 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
175 return Civi
::$statics[__CLASS__
]['fieldKeys'];
179 * Returns the names of this table
183 public static function getTableName() {
184 return self
::$_tableName;
188 * Returns if this table needs to be logged
192 public function getLog() {
197 * Returns the list of fields that can be imported
199 * @param bool $prefix
203 public static function &import($prefix = FALSE) {
204 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'premiums_product', $prefix, []);
209 * Returns the list of fields that can be exported
211 * @param bool $prefix
215 public static function &export($prefix = FALSE) {
216 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'premiums_product', $prefix, []);
221 * Returns the list of indices
223 * @param bool $localize
227 public static function indices($localize = TRUE) {
229 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;