Regenerate DAOs with readonly attribute for id fields
[civicrm-core.git] / CRM / Price / DAO / PriceSetEntity.php
1 <?php
2
3 /**
4 * @package CRM
5 * @copyright CiviCRM LLC https://civicrm.org/licensing
6 *
7 * Generated from xml/schema/CRM/Price/PriceSetEntity.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:725ada34ef925d58d65d76995dba0cfb)
10 */
11
12 /**
13 * Database access object for the PriceSetEntity entity.
14 */
15 class CRM_Price_DAO_PriceSetEntity extends CRM_Core_DAO {
16 const EXT = 'civicrm';
17 const TABLE_ADDED = '1.8';
18 const COMPONENT = 'CiviContribute';
19
20 /**
21 * Static instance to hold the table name.
22 *
23 * @var string
24 */
25 public static $_tableName = 'civicrm_price_set_entity';
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 * Price Set Entity
36 *
37 * @var int
38 */
39 public $id;
40
41 /**
42 * Table which uses this price set
43 *
44 * @var string
45 */
46 public $entity_table;
47
48 /**
49 * Item in table
50 *
51 * @var int
52 */
53 public $entity_id;
54
55 /**
56 * price set being used
57 *
58 * @var int
59 */
60 public $price_set_id;
61
62 /**
63 * Class constructor.
64 */
65 public function __construct() {
66 $this->__table = 'civicrm_price_set_entity';
67 parent::__construct();
68 }
69
70 /**
71 * Returns localized title of this entity.
72 *
73 * @param bool $plural
74 * Whether to return the plural version of the title.
75 */
76 public static function getEntityTitle($plural = FALSE) {
77 return $plural ? ts('Price Set Entities') : ts('Price Set Entity');
78 }
79
80 /**
81 * Returns foreign keys and entity references.
82 *
83 * @return array
84 * [CRM_Core_Reference_Interface]
85 */
86 public static function getReferenceColumns() {
87 if (!isset(Civi::$statics[__CLASS__]['links'])) {
88 Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__);
89 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'price_set_id', 'civicrm_price_set', 'id');
90 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Dynamic(self::getTableName(), 'entity_id', NULL, 'id', 'entity_table');
91 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
92 }
93 return Civi::$statics[__CLASS__]['links'];
94 }
95
96 /**
97 * Returns all the column names of this table
98 *
99 * @return array
100 */
101 public static function &fields() {
102 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
103 Civi::$statics[__CLASS__]['fields'] = [
104 'id' => [
105 'name' => 'id',
106 'type' => CRM_Utils_Type::T_INT,
107 'title' => ts('Price Set Entity ID'),
108 'description' => ts('Price Set Entity'),
109 'required' => TRUE,
110 'where' => 'civicrm_price_set_entity.id',
111 'table_name' => 'civicrm_price_set_entity',
112 'entity' => 'PriceSetEntity',
113 'bao' => 'CRM_Price_DAO_PriceSetEntity',
114 'localizable' => 0,
115 'html' => [
116 'type' => 'Number',
117 ],
118 'readonly' => TRUE,
119 'add' => '1.8',
120 ],
121 'entity_table' => [
122 'name' => 'entity_table',
123 'type' => CRM_Utils_Type::T_STRING,
124 'title' => ts('Entity Table'),
125 'description' => ts('Table which uses this price set'),
126 'required' => TRUE,
127 'maxlength' => 64,
128 'size' => CRM_Utils_Type::BIG,
129 'where' => 'civicrm_price_set_entity.entity_table',
130 'table_name' => 'civicrm_price_set_entity',
131 'entity' => 'PriceSetEntity',
132 'bao' => 'CRM_Price_DAO_PriceSetEntity',
133 'localizable' => 0,
134 'add' => '1.8',
135 ],
136 'entity_id' => [
137 'name' => 'entity_id',
138 'type' => CRM_Utils_Type::T_INT,
139 'title' => ts('Entity IF'),
140 'description' => ts('Item in table'),
141 'required' => TRUE,
142 'where' => 'civicrm_price_set_entity.entity_id',
143 'table_name' => 'civicrm_price_set_entity',
144 'entity' => 'PriceSetEntity',
145 'bao' => 'CRM_Price_DAO_PriceSetEntity',
146 'localizable' => 0,
147 'add' => '1.8',
148 ],
149 'price_set_id' => [
150 'name' => 'price_set_id',
151 'type' => CRM_Utils_Type::T_INT,
152 'title' => ts('Price Set ID'),
153 'description' => ts('price set being used'),
154 'required' => TRUE,
155 'where' => 'civicrm_price_set_entity.price_set_id',
156 'table_name' => 'civicrm_price_set_entity',
157 'entity' => 'PriceSetEntity',
158 'bao' => 'CRM_Price_DAO_PriceSetEntity',
159 'localizable' => 0,
160 'FKClassName' => 'CRM_Price_DAO_PriceSet',
161 'html' => [
162 'label' => ts("Price Set"),
163 ],
164 'pseudoconstant' => [
165 'table' => 'civicrm_price_set',
166 'keyColumn' => 'id',
167 'labelColumn' => 'title',
168 ],
169 'add' => '1.8',
170 ],
171 ];
172 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
173 }
174 return Civi::$statics[__CLASS__]['fields'];
175 }
176
177 /**
178 * Return a mapping from field-name to the corresponding key (as used in fields()).
179 *
180 * @return array
181 * Array(string $name => string $uniqueName).
182 */
183 public static function &fieldKeys() {
184 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
185 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
186 }
187 return Civi::$statics[__CLASS__]['fieldKeys'];
188 }
189
190 /**
191 * Returns the names of this table
192 *
193 * @return string
194 */
195 public static function getTableName() {
196 return self::$_tableName;
197 }
198
199 /**
200 * Returns if this table needs to be logged
201 *
202 * @return bool
203 */
204 public function getLog() {
205 return self::$_log;
206 }
207
208 /**
209 * Returns the list of fields that can be imported
210 *
211 * @param bool $prefix
212 *
213 * @return array
214 */
215 public static function &import($prefix = FALSE) {
216 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'price_set_entity', $prefix, []);
217 return $r;
218 }
219
220 /**
221 * Returns the list of fields that can be exported
222 *
223 * @param bool $prefix
224 *
225 * @return array
226 */
227 public static function &export($prefix = FALSE) {
228 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'price_set_entity', $prefix, []);
229 return $r;
230 }
231
232 /**
233 * Returns the list of indices
234 *
235 * @param bool $localize
236 *
237 * @return array
238 */
239 public static function indices($localize = TRUE) {
240 $indices = [
241 'UI_entity' => [
242 'name' => 'UI_entity',
243 'field' => [
244 0 => 'entity_table',
245 1 => 'entity_id',
246 ],
247 'localizable' => FALSE,
248 'unique' => TRUE,
249 'sig' => 'civicrm_price_set_entity::1::entity_table::entity_id',
250 ],
251 ];
252 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
253 }
254
255 }