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