Regenerate DAOs with readonly attribute for id fields
[civicrm-core.git] / CRM / Core / DAO / LocationType.php
1 <?php
2
3 /**
4 * @package CRM
5 * @copyright CiviCRM LLC https://civicrm.org/licensing
6 *
7 * Generated from xml/schema/CRM/Core/LocationType.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:b2109f10fffdacf38527863979dee49d)
10 */
11
12 /**
13 * Database access object for the LocationType entity.
14 */
15 class CRM_Core_DAO_LocationType extends CRM_Core_DAO {
16 const EXT = 'civicrm';
17 const TABLE_ADDED = '1.1';
18
19 /**
20 * Static instance to hold the table name.
21 *
22 * @var string
23 */
24 public static $_tableName = 'civicrm_location_type';
25
26 /**
27 * Should CiviCRM log any modifications to this table in the civicrm_log table.
28 *
29 * @var bool
30 */
31 public static $_log = TRUE;
32
33 /**
34 * Location Type ID
35 *
36 * @var int
37 */
38 public $id;
39
40 /**
41 * Location Type Name.
42 *
43 * @var string
44 */
45 public $name;
46
47 /**
48 * Location Type Display Name.
49 *
50 * @var string
51 */
52 public $display_name;
53
54 /**
55 * vCard Location Type Name.
56 *
57 * @var string
58 */
59 public $vcard_name;
60
61 /**
62 * Location Type Description.
63 *
64 * @var string
65 */
66 public $description;
67
68 /**
69 * Is this location type a predefined system location?
70 *
71 * @var bool
72 */
73 public $is_reserved;
74
75 /**
76 * Is this property active?
77 *
78 * @var bool
79 */
80 public $is_active;
81
82 /**
83 * Is this location type the default?
84 *
85 * @var bool
86 */
87 public $is_default;
88
89 /**
90 * Class constructor.
91 */
92 public function __construct() {
93 $this->__table = 'civicrm_location_type';
94 parent::__construct();
95 }
96
97 /**
98 * Returns localized title of this entity.
99 *
100 * @param bool $plural
101 * Whether to return the plural version of the title.
102 */
103 public static function getEntityTitle($plural = FALSE) {
104 return $plural ? ts('Location Types') : ts('Location Type');
105 }
106
107 /**
108 * Returns all the column names of this table
109 *
110 * @return array
111 */
112 public static function &fields() {
113 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
114 Civi::$statics[__CLASS__]['fields'] = [
115 'id' => [
116 'name' => 'id',
117 'type' => CRM_Utils_Type::T_INT,
118 'title' => ts('Location Type ID'),
119 'description' => ts('Location Type ID'),
120 'required' => TRUE,
121 'where' => 'civicrm_location_type.id',
122 'table_name' => 'civicrm_location_type',
123 'entity' => 'LocationType',
124 'bao' => 'CRM_Core_BAO_LocationType',
125 'localizable' => 0,
126 'html' => [
127 'type' => 'Number',
128 ],
129 'readonly' => TRUE,
130 'add' => '1.1',
131 ],
132 'name' => [
133 'name' => 'name',
134 'type' => CRM_Utils_Type::T_STRING,
135 'title' => ts('Location Type'),
136 'description' => ts('Location Type Name.'),
137 'maxlength' => 64,
138 'size' => CRM_Utils_Type::BIG,
139 'where' => 'civicrm_location_type.name',
140 'table_name' => 'civicrm_location_type',
141 'entity' => 'LocationType',
142 'bao' => 'CRM_Core_BAO_LocationType',
143 'localizable' => 0,
144 'add' => '1.1',
145 ],
146 'display_name' => [
147 'name' => 'display_name',
148 'type' => CRM_Utils_Type::T_STRING,
149 'title' => ts('Display Name'),
150 'description' => ts('Location Type Display Name.'),
151 'maxlength' => 64,
152 'size' => CRM_Utils_Type::BIG,
153 'where' => 'civicrm_location_type.display_name',
154 'table_name' => 'civicrm_location_type',
155 'entity' => 'LocationType',
156 'bao' => 'CRM_Core_BAO_LocationType',
157 'localizable' => 1,
158 'add' => '4.1',
159 ],
160 'vcard_name' => [
161 'name' => 'vcard_name',
162 'type' => CRM_Utils_Type::T_STRING,
163 'title' => ts('vCard Location Type'),
164 'description' => ts('vCard Location Type Name.'),
165 'maxlength' => 64,
166 'size' => CRM_Utils_Type::BIG,
167 'where' => 'civicrm_location_type.vcard_name',
168 'table_name' => 'civicrm_location_type',
169 'entity' => 'LocationType',
170 'bao' => 'CRM_Core_BAO_LocationType',
171 'localizable' => 0,
172 'add' => '1.1',
173 ],
174 'description' => [
175 'name' => 'description',
176 'type' => CRM_Utils_Type::T_STRING,
177 'title' => ts('Description'),
178 'description' => ts('Location Type Description.'),
179 'maxlength' => 255,
180 'size' => CRM_Utils_Type::HUGE,
181 'where' => 'civicrm_location_type.description',
182 'table_name' => 'civicrm_location_type',
183 'entity' => 'LocationType',
184 'bao' => 'CRM_Core_BAO_LocationType',
185 'localizable' => 0,
186 'html' => [
187 'label' => ts("Description"),
188 ],
189 'add' => '1.1',
190 ],
191 'is_reserved' => [
192 'name' => 'is_reserved',
193 'type' => CRM_Utils_Type::T_BOOLEAN,
194 'title' => ts('Location Type is Reserved?'),
195 'description' => ts('Is this location type a predefined system location?'),
196 'where' => 'civicrm_location_type.is_reserved',
197 'table_name' => 'civicrm_location_type',
198 'entity' => 'LocationType',
199 'bao' => 'CRM_Core_BAO_LocationType',
200 'localizable' => 0,
201 'add' => '1.1',
202 ],
203 'is_active' => [
204 'name' => 'is_active',
205 'type' => CRM_Utils_Type::T_BOOLEAN,
206 'title' => ts('Location Type is Active?'),
207 'description' => ts('Is this property active?'),
208 'where' => 'civicrm_location_type.is_active',
209 'table_name' => 'civicrm_location_type',
210 'entity' => 'LocationType',
211 'bao' => 'CRM_Core_BAO_LocationType',
212 'localizable' => 0,
213 'add' => '1.1',
214 ],
215 'is_default' => [
216 'name' => 'is_default',
217 'type' => CRM_Utils_Type::T_BOOLEAN,
218 'title' => ts('Default Location Type?'),
219 'description' => ts('Is this location type the default?'),
220 'where' => 'civicrm_location_type.is_default',
221 'table_name' => 'civicrm_location_type',
222 'entity' => 'LocationType',
223 'bao' => 'CRM_Core_BAO_LocationType',
224 'localizable' => 0,
225 'add' => '1.1',
226 ],
227 ];
228 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
229 }
230 return Civi::$statics[__CLASS__]['fields'];
231 }
232
233 /**
234 * Return a mapping from field-name to the corresponding key (as used in fields()).
235 *
236 * @return array
237 * Array(string $name => string $uniqueName).
238 */
239 public static function &fieldKeys() {
240 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
241 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
242 }
243 return Civi::$statics[__CLASS__]['fieldKeys'];
244 }
245
246 /**
247 * Returns the names of this table
248 *
249 * @return string
250 */
251 public static function getTableName() {
252 return CRM_Core_DAO::getLocaleTableName(self::$_tableName);
253 }
254
255 /**
256 * Returns if this table needs to be logged
257 *
258 * @return bool
259 */
260 public function getLog() {
261 return self::$_log;
262 }
263
264 /**
265 * Returns the list of fields that can be imported
266 *
267 * @param bool $prefix
268 *
269 * @return array
270 */
271 public static function &import($prefix = FALSE) {
272 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'location_type', $prefix, []);
273 return $r;
274 }
275
276 /**
277 * Returns the list of fields that can be exported
278 *
279 * @param bool $prefix
280 *
281 * @return array
282 */
283 public static function &export($prefix = FALSE) {
284 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'location_type', $prefix, []);
285 return $r;
286 }
287
288 /**
289 * Returns the list of indices
290 *
291 * @param bool $localize
292 *
293 * @return array
294 */
295 public static function indices($localize = TRUE) {
296 $indices = [
297 'UI_name' => [
298 'name' => 'UI_name',
299 'field' => [
300 0 => 'name',
301 ],
302 'localizable' => FALSE,
303 'unique' => TRUE,
304 'sig' => 'civicrm_location_type::1::name',
305 ],
306 ];
307 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
308 }
309
310 }