Add titles and icons to entities
[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
449c4e6b 9 * (GenCodeChecksum:c0e05c7f98e0801599d18ab12b1937a7)
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 *
e6ca0a57 34 * @var int
e501603b
TO
35 */
36 public $id;
c3fc2621 37
e501603b
TO
38 /**
39 * Foreign key to premiums settings record.
40 *
e6ca0a57 41 * @var int
e501603b
TO
42 */
43 public $premiums_id;
c3fc2621 44
e501603b
TO
45 /**
46 * Foreign key to each product object.
47 *
e6ca0a57 48 * @var int
e501603b
TO
49 */
50 public $product_id;
c3fc2621 51
e501603b 52 /**
e6ca0a57 53 * @var int
e501603b
TO
54 */
55 public $weight;
c3fc2621 56
e501603b
TO
57 /**
58 * FK to Financial Type.
59 *
e6ca0a57 60 * @var int
e501603b
TO
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
449c4e6b
CW
72 /**
73 * Returns localized title of this entity.
74 */
75 public static function getEntityTitle() {
76 return ts('Premiums Products');
77 }
78
e501603b 79 /**
f41f0342 80 * Returns foreign keys and entity references.
e501603b
TO
81 *
82 * @return array
83 * [CRM_Core_Reference_Interface]
84 */
c3fc2621 85 public static function getReferenceColumns() {
346aaaba 86 if (!isset(Civi::$statics[__CLASS__]['links'])) {
fa45b5b9 87 Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__);
c3fc2621
CW
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');
346aaaba 91 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
e501603b 92 }
346aaaba 93 return Civi::$statics[__CLASS__]['links'];
e501603b 94 }
c3fc2621 95
e501603b
TO
96 /**
97 * Returns all the column names of this table
98 *
99 * @return array
100 */
c3fc2621 101 public static function &fields() {
346aaaba 102 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
c3fc2621
CW
103 Civi::$statics[__CLASS__]['fields'] = [
104 'id' => [
e501603b
TO
105 'name' => 'id',
106 'type' => CRM_Utils_Type::T_INT,
c3fc2621 107 'title' => ts('Premium Product ID'),
215b423e 108 'description' => ts('Contribution ID'),
c3fc2621 109 'required' => TRUE,
a36434b9 110 'where' => 'civicrm_premiums_product.id',
522a26c9 111 'table_name' => 'civicrm_premiums_product',
112 'entity' => 'PremiumsProduct',
113 'bao' => 'CRM_Contribute_DAO_PremiumsProduct',
6a7e5e5d 114 'localizable' => 0,
c3fc2621
CW
115 ],
116 'premiums_id' => [
e501603b
TO
117 'name' => 'premiums_id',
118 'type' => CRM_Utils_Type::T_INT,
c3fc2621 119 'title' => ts('Premium'),
215b423e 120 'description' => ts('Foreign key to premiums settings record.'),
c3fc2621 121 'required' => TRUE,
a36434b9 122 'where' => 'civicrm_premiums_product.premiums_id',
522a26c9 123 'table_name' => 'civicrm_premiums_product',
124 'entity' => 'PremiumsProduct',
125 'bao' => 'CRM_Contribute_DAO_PremiumsProduct',
6a7e5e5d 126 'localizable' => 0,
e501603b 127 'FKClassName' => 'CRM_Contribute_DAO_Premium',
c3fc2621
CW
128 ],
129 'product_id' => [
e501603b
TO
130 'name' => 'product_id',
131 'type' => CRM_Utils_Type::T_INT,
c3fc2621 132 'title' => ts('Product'),
215b423e 133 'description' => ts('Foreign key to each product object.'),
c3fc2621 134 'required' => TRUE,
a36434b9 135 'where' => 'civicrm_premiums_product.product_id',
522a26c9 136 'table_name' => 'civicrm_premiums_product',
137 'entity' => 'PremiumsProduct',
138 'bao' => 'CRM_Contribute_DAO_PremiumsProduct',
6a7e5e5d 139 'localizable' => 0,
e501603b 140 'FKClassName' => 'CRM_Contribute_DAO_Product',
c3fc2621
CW
141 ],
142 'weight' => [
e501603b
TO
143 'name' => 'weight',
144 'type' => CRM_Utils_Type::T_INT,
c3fc2621
CW
145 'title' => ts('Order'),
146 'required' => TRUE,
a36434b9 147 'where' => 'civicrm_premiums_product.weight',
522a26c9 148 'table_name' => 'civicrm_premiums_product',
149 'entity' => 'PremiumsProduct',
150 'bao' => 'CRM_Contribute_DAO_PremiumsProduct',
6a7e5e5d 151 'localizable' => 0,
c3fc2621
CW
152 ],
153 'financial_type_id' => [
e501603b
TO
154 'name' => 'financial_type_id',
155 'type' => CRM_Utils_Type::T_INT,
c3fc2621 156 'title' => ts('Financial Type'),
215b423e 157 'description' => ts('FK to Financial Type.'),
a36434b9 158 'where' => 'civicrm_premiums_product.financial_type_id',
e501603b 159 'default' => 'NULL',
522a26c9 160 'table_name' => 'civicrm_premiums_product',
161 'entity' => 'PremiumsProduct',
162 'bao' => 'CRM_Contribute_DAO_PremiumsProduct',
6a7e5e5d 163 'localizable' => 0,
e501603b 164 'FKClassName' => 'CRM_Financial_DAO_FinancialType',
c3fc2621 165 'pseudoconstant' => [
e501603b
TO
166 'table' => 'civicrm_financial_type',
167 'keyColumn' => 'id',
168 'labelColumn' => 'name',
e6ca0a57 169 ],
c3fc2621
CW
170 ],
171 ];
346aaaba 172 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
e501603b 173 }
346aaaba 174 return Civi::$statics[__CLASS__]['fields'];
e501603b 175 }
c3fc2621 176
e501603b 177 /**
bd8e0b14 178 * Return a mapping from field-name to the corresponding key (as used in fields()).
e501603b
TO
179 *
180 * @return array
bd8e0b14 181 * Array(string $name => string $uniqueName).
e501603b 182 */
c3fc2621 183 public static function &fieldKeys() {
bd8e0b14
TO
184 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
185 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
e501603b 186 }
bd8e0b14 187 return Civi::$statics[__CLASS__]['fieldKeys'];
e501603b 188 }
c3fc2621 189
e501603b
TO
190 /**
191 * Returns the names of this table
192 *
193 * @return string
194 */
c3fc2621 195 public static function getTableName() {
e501603b
TO
196 return self::$_tableName;
197 }
c3fc2621 198
e501603b
TO
199 /**
200 * Returns if this table needs to be logged
201 *
c3fc2621 202 * @return bool
e501603b 203 */
c3fc2621 204 public function getLog() {
e501603b
TO
205 return self::$_log;
206 }
c3fc2621 207
e501603b
TO
208 /**
209 * Returns the list of fields that can be imported
210 *
211 * @param bool $prefix
212 *
213 * @return array
214 */
c3fc2621
CW
215 public static function &import($prefix = FALSE) {
216 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'premiums_product', $prefix, []);
60808919 217 return $r;
e501603b 218 }
c3fc2621 219
e501603b
TO
220 /**
221 * Returns the list of fields that can be exported
222 *
223 * @param bool $prefix
224 *
225 * @return array
226 */
c3fc2621
CW
227 public static function &export($prefix = FALSE) {
228 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'premiums_product', $prefix, []);
60808919 229 return $r;
e501603b 230 }
c3fc2621 231
e7a6b91a
AS
232 /**
233 * Returns the list of indices
c3fc2621
CW
234 *
235 * @param bool $localize
236 *
237 * @return array
e7a6b91a
AS
238 */
239 public static function indices($localize = TRUE) {
c3fc2621 240 $indices = [];
e7a6b91a
AS
241 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
242 }
c3fc2621 243
e501603b 244}