curious
[civicrm-core.git] / CRM / Contribute / DAO / PremiumsProduct.php
CommitLineData
e501603b 1<?php
c3fc2621 2
e501603b
TO
3/**
4 * @package CRM
ca5cec67 5 * @copyright CiviCRM LLC https://civicrm.org/licensing
e501603b
TO
6 *
7 * Generated from xml/schema/CRM/Contribute/PremiumsProduct.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
2562d09a 9 * (GenCodeChecksum:41745812fcc812419159f6a93b52a715)
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 {
929a1c14
CW
16 const EXT = 'civicrm';
17 const TABLE_ADDED = '1.4';
d31fb4e3 18 const COMPONENT = 'CiviContribute';
c3fc2621 19
e501603b 20 /**
f41f0342 21 * Static instance to hold the table name.
e501603b
TO
22 *
23 * @var string
24 */
fa45b5b9 25 public static $_tableName = 'civicrm_premiums_product';
c3fc2621 26
e501603b 27 /**
f41f0342 28 * Should CiviCRM log any modifications to this table in the civicrm_log table.
e501603b 29 *
c3fc2621 30 * @var bool
e501603b 31 */
fa45b5b9 32 public static $_log = TRUE;
c3fc2621 33
e501603b
TO
34 /**
35 * Contribution ID
36 *
e6ca0a57 37 * @var int
e501603b
TO
38 */
39 public $id;
c3fc2621 40
e501603b
TO
41 /**
42 * Foreign key to premiums settings record.
43 *
e6ca0a57 44 * @var int
e501603b
TO
45 */
46 public $premiums_id;
c3fc2621 47
e501603b
TO
48 /**
49 * Foreign key to each product object.
50 *
e6ca0a57 51 * @var int
e501603b
TO
52 */
53 public $product_id;
c3fc2621 54
e501603b 55 /**
e6ca0a57 56 * @var int
e501603b
TO
57 */
58 public $weight;
c3fc2621 59
e501603b
TO
60 /**
61 * FK to Financial Type.
62 *
e6ca0a57 63 * @var int
e501603b
TO
64 */
65 public $financial_type_id;
c3fc2621 66
e501603b 67 /**
f41f0342 68 * Class constructor.
e501603b 69 */
c3fc2621 70 public function __construct() {
e501603b
TO
71 $this->__table = 'civicrm_premiums_product';
72 parent::__construct();
73 }
c3fc2621 74
449c4e6b
CW
75 /**
76 * Returns localized title of this entity.
7b66c3b5
AH
77 *
78 * @param bool $plural
79 * Whether to return the plural version of the title.
449c4e6b 80 */
7b66c3b5 81 public static function getEntityTitle($plural = FALSE) {
95820237 82 return $plural ? ts('Product Premiums') : ts('Product Premium');
449c4e6b
CW
83 }
84
e501603b 85 /**
f41f0342 86 * Returns foreign keys and entity references.
e501603b
TO
87 *
88 * @return array
89 * [CRM_Core_Reference_Interface]
90 */
c3fc2621 91 public static function getReferenceColumns() {
346aaaba 92 if (!isset(Civi::$statics[__CLASS__]['links'])) {
fa45b5b9 93 Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__);
c3fc2621
CW
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');
346aaaba 97 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
e501603b 98 }
346aaaba 99 return Civi::$statics[__CLASS__]['links'];
e501603b 100 }
c3fc2621 101
e501603b
TO
102 /**
103 * Returns all the column names of this table
104 *
105 * @return array
106 */
c3fc2621 107 public static function &fields() {
346aaaba 108 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
c3fc2621
CW
109 Civi::$statics[__CLASS__]['fields'] = [
110 'id' => [
e501603b
TO
111 'name' => 'id',
112 'type' => CRM_Utils_Type::T_INT,
c3fc2621 113 'title' => ts('Premium Product ID'),
215b423e 114 'description' => ts('Contribution ID'),
c3fc2621 115 'required' => TRUE,
a36434b9 116 'where' => 'civicrm_premiums_product.id',
522a26c9 117 'table_name' => 'civicrm_premiums_product',
118 'entity' => 'PremiumsProduct',
119 'bao' => 'CRM_Contribute_DAO_PremiumsProduct',
6a7e5e5d 120 'localizable' => 0,
2cbbebe8
A
121 'html' => [
122 'type' => 'Number',
123 ],
1fe423d6 124 'readonly' => TRUE,
a9d0587b 125 'add' => '1.4',
c3fc2621
CW
126 ],
127 'premiums_id' => [
e501603b
TO
128 'name' => 'premiums_id',
129 'type' => CRM_Utils_Type::T_INT,
2cbbebe8 130 'title' => ts('Premium ID'),
215b423e 131 'description' => ts('Foreign key to premiums settings record.'),
c3fc2621 132 'required' => TRUE,
a36434b9 133 'where' => 'civicrm_premiums_product.premiums_id',
522a26c9 134 'table_name' => 'civicrm_premiums_product',
135 'entity' => 'PremiumsProduct',
136 'bao' => 'CRM_Contribute_DAO_PremiumsProduct',
6a7e5e5d 137 'localizable' => 0,
e501603b 138 'FKClassName' => 'CRM_Contribute_DAO_Premium',
2cbbebe8
A
139 'html' => [
140 'label' => ts("Premium"),
141 ],
a9d0587b 142 'add' => '1.4',
c3fc2621
CW
143 ],
144 'product_id' => [
e501603b
TO
145 'name' => 'product_id',
146 'type' => CRM_Utils_Type::T_INT,
2cbbebe8 147 'title' => ts('Product ID'),
215b423e 148 'description' => ts('Foreign key to each product object.'),
c3fc2621 149 'required' => TRUE,
a36434b9 150 'where' => 'civicrm_premiums_product.product_id',
522a26c9 151 'table_name' => 'civicrm_premiums_product',
152 'entity' => 'PremiumsProduct',
153 'bao' => 'CRM_Contribute_DAO_PremiumsProduct',
6a7e5e5d 154 'localizable' => 0,
e501603b 155 'FKClassName' => 'CRM_Contribute_DAO_Product',
2cbbebe8
A
156 'html' => [
157 'label' => ts("Product"),
158 ],
a9d0587b 159 'add' => '1.4',
c3fc2621
CW
160 ],
161 'weight' => [
e501603b
TO
162 'name' => 'weight',
163 'type' => CRM_Utils_Type::T_INT,
c3fc2621
CW
164 'title' => ts('Order'),
165 'required' => TRUE,
a36434b9 166 'where' => 'civicrm_premiums_product.weight',
522a26c9 167 'table_name' => 'civicrm_premiums_product',
168 'entity' => 'PremiumsProduct',
169 'bao' => 'CRM_Contribute_DAO_PremiumsProduct',
6a7e5e5d 170 'localizable' => 0,
a9d0587b 171 'add' => '2.0',
c3fc2621
CW
172 ],
173 'financial_type_id' => [
e501603b
TO
174 'name' => 'financial_type_id',
175 'type' => CRM_Utils_Type::T_INT,
2cbbebe8 176 'title' => ts('Financial Type ID'),
215b423e 177 'description' => ts('FK to Financial Type.'),
a36434b9 178 'where' => 'civicrm_premiums_product.financial_type_id',
5fb0de1f 179 'default' => NULL,
522a26c9 180 'table_name' => 'civicrm_premiums_product',
181 'entity' => 'PremiumsProduct',
182 'bao' => 'CRM_Contribute_DAO_PremiumsProduct',
6a7e5e5d 183 'localizable' => 0,
e501603b 184 'FKClassName' => 'CRM_Financial_DAO_FinancialType',
2cbbebe8
A
185 'html' => [
186 'label' => ts("Financial Type"),
187 ],
c3fc2621 188 'pseudoconstant' => [
e501603b
TO
189 'table' => 'civicrm_financial_type',
190 'keyColumn' => 'id',
191 'labelColumn' => 'name',
e6ca0a57 192 ],
a9d0587b 193 'add' => '4.3',
c3fc2621
CW
194 ],
195 ];
346aaaba 196 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
e501603b 197 }
346aaaba 198 return Civi::$statics[__CLASS__]['fields'];
e501603b 199 }
c3fc2621 200
e501603b 201 /**
bd8e0b14 202 * Return a mapping from field-name to the corresponding key (as used in fields()).
e501603b
TO
203 *
204 * @return array
bd8e0b14 205 * Array(string $name => string $uniqueName).
e501603b 206 */
c3fc2621 207 public static function &fieldKeys() {
bd8e0b14
TO
208 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
209 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
e501603b 210 }
bd8e0b14 211 return Civi::$statics[__CLASS__]['fieldKeys'];
e501603b 212 }
c3fc2621 213
e501603b
TO
214 /**
215 * Returns the names of this table
216 *
217 * @return string
218 */
c3fc2621 219 public static function getTableName() {
e501603b
TO
220 return self::$_tableName;
221 }
c3fc2621 222
e501603b
TO
223 /**
224 * Returns if this table needs to be logged
225 *
c3fc2621 226 * @return bool
e501603b 227 */
c3fc2621 228 public function getLog() {
e501603b
TO
229 return self::$_log;
230 }
c3fc2621 231
e501603b
TO
232 /**
233 * Returns the list of fields that can be imported
234 *
235 * @param bool $prefix
236 *
237 * @return array
238 */
c3fc2621
CW
239 public static function &import($prefix = FALSE) {
240 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'premiums_product', $prefix, []);
60808919 241 return $r;
e501603b 242 }
c3fc2621 243
e501603b
TO
244 /**
245 * Returns the list of fields that can be exported
246 *
247 * @param bool $prefix
248 *
249 * @return array
250 */
c3fc2621
CW
251 public static function &export($prefix = FALSE) {
252 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'premiums_product', $prefix, []);
60808919 253 return $r;
e501603b 254 }
c3fc2621 255
e7a6b91a
AS
256 /**
257 * Returns the list of indices
c3fc2621
CW
258 *
259 * @param bool $localize
260 *
261 * @return array
e7a6b91a
AS
262 */
263 public static function indices($localize = TRUE) {
c3fc2621 264 $indices = [];
e7a6b91a
AS
265 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
266 }
c3fc2621 267
e501603b 268}