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