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:c0e05c7f98e0801599d18ab12b1937a7)
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 public static $_tableName = 'civicrm_premiums_product';
25 * Should CiviCRM log any modifications to this table in the civicrm_log table.
29 public static $_log = TRUE;
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 localized title of this entity.
75 public static function getEntityTitle() {
76 return ts('Premiums Products');
80 * Returns foreign keys and entity references.
83 * [CRM_Core_Reference_Interface]
85 public static function getReferenceColumns() {
86 if (!isset(Civi
::$statics[__CLASS__
]['links'])) {
87 Civi
::$statics[__CLASS__
]['links'] = static::createReferenceColumns(__CLASS__
);
88 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'premiums_id', 'civicrm_premiums', 'id');
89 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'product_id', 'civicrm_product', 'id');
90 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'financial_type_id', 'civicrm_financial_type', 'id');
91 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'links_callback', Civi
::$statics[__CLASS__
]['links']);
93 return Civi
::$statics[__CLASS__
]['links'];
97 * Returns all the column names of this table
101 public static function &fields() {
102 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
103 Civi
::$statics[__CLASS__
]['fields'] = [
106 'type' => CRM_Utils_Type
::T_INT
,
107 'title' => ts('Premium Product ID'),
108 'description' => ts('Contribution ID'),
110 'where' => 'civicrm_premiums_product.id',
111 'table_name' => 'civicrm_premiums_product',
112 'entity' => 'PremiumsProduct',
113 'bao' => 'CRM_Contribute_DAO_PremiumsProduct',
117 'name' => 'premiums_id',
118 'type' => CRM_Utils_Type
::T_INT
,
119 'title' => ts('Premium'),
120 'description' => ts('Foreign key to premiums settings record.'),
122 'where' => 'civicrm_premiums_product.premiums_id',
123 'table_name' => 'civicrm_premiums_product',
124 'entity' => 'PremiumsProduct',
125 'bao' => 'CRM_Contribute_DAO_PremiumsProduct',
127 'FKClassName' => 'CRM_Contribute_DAO_Premium',
130 'name' => 'product_id',
131 'type' => CRM_Utils_Type
::T_INT
,
132 'title' => ts('Product'),
133 'description' => ts('Foreign key to each product object.'),
135 'where' => 'civicrm_premiums_product.product_id',
136 'table_name' => 'civicrm_premiums_product',
137 'entity' => 'PremiumsProduct',
138 'bao' => 'CRM_Contribute_DAO_PremiumsProduct',
140 'FKClassName' => 'CRM_Contribute_DAO_Product',
144 'type' => CRM_Utils_Type
::T_INT
,
145 'title' => ts('Order'),
147 'where' => 'civicrm_premiums_product.weight',
148 'table_name' => 'civicrm_premiums_product',
149 'entity' => 'PremiumsProduct',
150 'bao' => 'CRM_Contribute_DAO_PremiumsProduct',
153 'financial_type_id' => [
154 'name' => 'financial_type_id',
155 'type' => CRM_Utils_Type
::T_INT
,
156 'title' => ts('Financial Type'),
157 'description' => ts('FK to Financial Type.'),
158 'where' => 'civicrm_premiums_product.financial_type_id',
160 'table_name' => 'civicrm_premiums_product',
161 'entity' => 'PremiumsProduct',
162 'bao' => 'CRM_Contribute_DAO_PremiumsProduct',
164 'FKClassName' => 'CRM_Financial_DAO_FinancialType',
165 'pseudoconstant' => [
166 'table' => 'civicrm_financial_type',
168 'labelColumn' => 'name',
172 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
174 return Civi
::$statics[__CLASS__
]['fields'];
178 * Return a mapping from field-name to the corresponding key (as used in fields()).
181 * Array(string $name => string $uniqueName).
183 public static function &fieldKeys() {
184 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
185 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
187 return Civi
::$statics[__CLASS__
]['fieldKeys'];
191 * Returns the names of this table
195 public static function getTableName() {
196 return self
::$_tableName;
200 * Returns if this table needs to be logged
204 public function getLog() {
209 * Returns the list of fields that can be imported
211 * @param bool $prefix
215 public static function &import($prefix = FALSE) {
216 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'premiums_product', $prefix, []);
221 * Returns the list of fields that can be exported
223 * @param bool $prefix
227 public static function &export($prefix = FALSE) {
228 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'premiums_product', $prefix, []);
233 * Returns the list of indices
235 * @param bool $localize
239 public static function indices($localize = TRUE) {
241 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;