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:41745812fcc812419159f6a93b52a715)
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',
128 'name' => 'premiums_id',
129 'type' => CRM_Utils_Type
::T_INT
,
130 'title' => ts('Premium ID'),
131 'description' => ts('Foreign key to premiums settings record.'),
133 'where' => 'civicrm_premiums_product.premiums_id',
134 'table_name' => 'civicrm_premiums_product',
135 'entity' => 'PremiumsProduct',
136 'bao' => 'CRM_Contribute_DAO_PremiumsProduct',
138 'FKClassName' => 'CRM_Contribute_DAO_Premium',
140 'label' => ts("Premium"),
145 'name' => 'product_id',
146 'type' => CRM_Utils_Type
::T_INT
,
147 'title' => ts('Product ID'),
148 'description' => ts('Foreign key to each product object.'),
150 'where' => 'civicrm_premiums_product.product_id',
151 'table_name' => 'civicrm_premiums_product',
152 'entity' => 'PremiumsProduct',
153 'bao' => 'CRM_Contribute_DAO_PremiumsProduct',
155 'FKClassName' => 'CRM_Contribute_DAO_Product',
157 'label' => ts("Product"),
163 'type' => CRM_Utils_Type
::T_INT
,
164 'title' => ts('Order'),
166 'where' => 'civicrm_premiums_product.weight',
167 'table_name' => 'civicrm_premiums_product',
168 'entity' => 'PremiumsProduct',
169 'bao' => 'CRM_Contribute_DAO_PremiumsProduct',
173 'financial_type_id' => [
174 'name' => 'financial_type_id',
175 'type' => CRM_Utils_Type
::T_INT
,
176 'title' => ts('Financial Type ID'),
177 'description' => ts('FK to Financial Type.'),
178 'where' => 'civicrm_premiums_product.financial_type_id',
180 'table_name' => 'civicrm_premiums_product',
181 'entity' => 'PremiumsProduct',
182 'bao' => 'CRM_Contribute_DAO_PremiumsProduct',
184 'FKClassName' => 'CRM_Financial_DAO_FinancialType',
186 'label' => ts("Financial Type"),
188 'pseudoconstant' => [
189 'table' => 'civicrm_financial_type',
191 'labelColumn' => 'name',
196 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
198 return Civi
::$statics[__CLASS__
]['fields'];
202 * Return a mapping from field-name to the corresponding key (as used in fields()).
205 * Array(string $name => string $uniqueName).
207 public static function &fieldKeys() {
208 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
209 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
211 return Civi
::$statics[__CLASS__
]['fieldKeys'];
215 * Returns the names of this table
219 public static function getTableName() {
220 return self
::$_tableName;
224 * Returns if this table needs to be logged
228 public function getLog() {
233 * Returns the list of fields that can be imported
235 * @param bool $prefix
239 public static function &import($prefix = FALSE) {
240 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'premiums_product', $prefix, []);
245 * Returns the list of fields that can be exported
247 * @param bool $prefix
251 public static function &export($prefix = FALSE) {
252 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'premiums_product', $prefix, []);
257 * Returns the list of indices
259 * @param bool $localize
263 public static function indices($localize = TRUE) {
265 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;