Update dao.tpl to not make presence of import or export required to add 'where' param
[civicrm-core.git] / CRM / Contribute / DAO / PremiumsProduct.php
CommitLineData
e501603b 1<?php
c3fc2621 2
e501603b
TO
3/**
4 * @package CRM
6b83d5bd 5 * @copyright CiviCRM LLC (c) 2004-2019
e501603b
TO
6 *
7 * Generated from xml/schema/CRM/Contribute/PremiumsProduct.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
e380ee3b 9 * (GenCodeChecksum:b6944ad257ea16a60d6c1cf79ca391b0)
e501603b 10 */
c3fc2621 11
f41f0342 12/**
c3fc2621 13 * Database access object for the PremiumsProduct entity.
f41f0342 14 */
e501603b 15class CRM_Contribute_DAO_PremiumsProduct extends CRM_Core_DAO {
c3fc2621 16
e501603b 17 /**
f41f0342 18 * Static instance to hold the table name.
e501603b
TO
19 *
20 * @var string
21 */
fa45b5b9 22 public static $_tableName = 'civicrm_premiums_product';
c3fc2621 23
e501603b 24 /**
f41f0342 25 * Should CiviCRM log any modifications to this table in the civicrm_log table.
e501603b 26 *
c3fc2621 27 * @var bool
e501603b 28 */
fa45b5b9 29 public static $_log = TRUE;
c3fc2621 30
e501603b
TO
31 /**
32 * Contribution ID
33 *
34 * @var int unsigned
35 */
36 public $id;
c3fc2621 37
e501603b
TO
38 /**
39 * Foreign key to premiums settings record.
40 *
41 * @var int unsigned
42 */
43 public $premiums_id;
c3fc2621 44
e501603b
TO
45 /**
46 * Foreign key to each product object.
47 *
48 * @var int unsigned
49 */
50 public $product_id;
c3fc2621 51
e501603b 52 /**
e501603b
TO
53 * @var int unsigned
54 */
55 public $weight;
c3fc2621 56
e501603b
TO
57 /**
58 * FK to Financial Type.
59 *
60 * @var int unsigned
61 */
62 public $financial_type_id;
c3fc2621 63
e501603b 64 /**
f41f0342 65 * Class constructor.
e501603b 66 */
c3fc2621 67 public function __construct() {
e501603b
TO
68 $this->__table = 'civicrm_premiums_product';
69 parent::__construct();
70 }
c3fc2621 71
e501603b 72 /**
f41f0342 73 * Returns foreign keys and entity references.
e501603b
TO
74 *
75 * @return array
76 * [CRM_Core_Reference_Interface]
77 */
c3fc2621 78 public static function getReferenceColumns() {
346aaaba 79 if (!isset(Civi::$statics[__CLASS__]['links'])) {
fa45b5b9 80 Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__);
c3fc2621
CW
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');
346aaaba 84 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
e501603b 85 }
346aaaba 86 return Civi::$statics[__CLASS__]['links'];
e501603b 87 }
c3fc2621 88
e501603b
TO
89 /**
90 * Returns all the column names of this table
91 *
92 * @return array
93 */
c3fc2621 94 public static function &fields() {
346aaaba 95 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
c3fc2621
CW
96 Civi::$statics[__CLASS__]['fields'] = [
97 'id' => [
e501603b
TO
98 'name' => 'id',
99 'type' => CRM_Utils_Type::T_INT,
c3fc2621 100 'title' => ts('Premium Product ID'),
215b423e 101 'description' => ts('Contribution ID'),
c3fc2621 102 'required' => TRUE,
522a26c9 103 'table_name' => 'civicrm_premiums_product',
104 'entity' => 'PremiumsProduct',
105 'bao' => 'CRM_Contribute_DAO_PremiumsProduct',
6a7e5e5d 106 'localizable' => 0,
c3fc2621
CW
107 ],
108 'premiums_id' => [
e501603b
TO
109 'name' => 'premiums_id',
110 'type' => CRM_Utils_Type::T_INT,
c3fc2621 111 'title' => ts('Premium'),
215b423e 112 'description' => ts('Foreign key to premiums settings record.'),
c3fc2621 113 'required' => TRUE,
522a26c9 114 'table_name' => 'civicrm_premiums_product',
115 'entity' => 'PremiumsProduct',
116 'bao' => 'CRM_Contribute_DAO_PremiumsProduct',
6a7e5e5d 117 'localizable' => 0,
e501603b 118 'FKClassName' => 'CRM_Contribute_DAO_Premium',
c3fc2621
CW
119 ],
120 'product_id' => [
e501603b
TO
121 'name' => 'product_id',
122 'type' => CRM_Utils_Type::T_INT,
c3fc2621 123 'title' => ts('Product'),
215b423e 124 'description' => ts('Foreign key to each product object.'),
c3fc2621 125 'required' => TRUE,
522a26c9 126 'table_name' => 'civicrm_premiums_product',
127 'entity' => 'PremiumsProduct',
128 'bao' => 'CRM_Contribute_DAO_PremiumsProduct',
6a7e5e5d 129 'localizable' => 0,
e501603b 130 'FKClassName' => 'CRM_Contribute_DAO_Product',
c3fc2621
CW
131 ],
132 'weight' => [
e501603b
TO
133 'name' => 'weight',
134 'type' => CRM_Utils_Type::T_INT,
c3fc2621
CW
135 'title' => ts('Order'),
136 'required' => TRUE,
522a26c9 137 'table_name' => 'civicrm_premiums_product',
138 'entity' => 'PremiumsProduct',
139 'bao' => 'CRM_Contribute_DAO_PremiumsProduct',
6a7e5e5d 140 'localizable' => 0,
c3fc2621
CW
141 ],
142 'financial_type_id' => [
e501603b
TO
143 'name' => 'financial_type_id',
144 'type' => CRM_Utils_Type::T_INT,
c3fc2621 145 'title' => ts('Financial Type'),
215b423e 146 'description' => ts('FK to Financial Type.'),
e501603b 147 'default' => 'NULL',
522a26c9 148 'table_name' => 'civicrm_premiums_product',
149 'entity' => 'PremiumsProduct',
150 'bao' => 'CRM_Contribute_DAO_PremiumsProduct',
6a7e5e5d 151 'localizable' => 0,
e501603b 152 'FKClassName' => 'CRM_Financial_DAO_FinancialType',
c3fc2621 153 'pseudoconstant' => [
e501603b
TO
154 'table' => 'civicrm_financial_type',
155 'keyColumn' => 'id',
156 'labelColumn' => 'name',
c3fc2621
CW
157 ]
158 ],
159 ];
346aaaba 160 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
e501603b 161 }
346aaaba 162 return Civi::$statics[__CLASS__]['fields'];
e501603b 163 }
c3fc2621 164
e501603b 165 /**
bd8e0b14 166 * Return a mapping from field-name to the corresponding key (as used in fields()).
e501603b
TO
167 *
168 * @return array
bd8e0b14 169 * Array(string $name => string $uniqueName).
e501603b 170 */
c3fc2621 171 public static function &fieldKeys() {
bd8e0b14
TO
172 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
173 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
e501603b 174 }
bd8e0b14 175 return Civi::$statics[__CLASS__]['fieldKeys'];
e501603b 176 }
c3fc2621 177
e501603b
TO
178 /**
179 * Returns the names of this table
180 *
181 * @return string
182 */
c3fc2621 183 public static function getTableName() {
e501603b
TO
184 return self::$_tableName;
185 }
c3fc2621 186
e501603b
TO
187 /**
188 * Returns if this table needs to be logged
189 *
c3fc2621 190 * @return bool
e501603b 191 */
c3fc2621 192 public function getLog() {
e501603b
TO
193 return self::$_log;
194 }
c3fc2621 195
e501603b
TO
196 /**
197 * Returns the list of fields that can be imported
198 *
199 * @param bool $prefix
200 *
201 * @return array
202 */
c3fc2621
CW
203 public static function &import($prefix = FALSE) {
204 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'premiums_product', $prefix, []);
60808919 205 return $r;
e501603b 206 }
c3fc2621 207
e501603b
TO
208 /**
209 * Returns the list of fields that can be exported
210 *
211 * @param bool $prefix
212 *
213 * @return array
214 */
c3fc2621
CW
215 public static function &export($prefix = FALSE) {
216 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'premiums_product', $prefix, []);
60808919 217 return $r;
e501603b 218 }
c3fc2621 219
e7a6b91a
AS
220 /**
221 * Returns the list of indices
c3fc2621
CW
222 *
223 * @param bool $localize
224 *
225 * @return array
e7a6b91a
AS
226 */
227 public static function indices($localize = TRUE) {
c3fc2621 228 $indices = [];
e7a6b91a
AS
229 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
230 }
c3fc2621 231
e501603b 232}