Merge pull request #19075 from colemanw/searchable
[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
d31fb4e3 9 * (GenCodeChecksum:0aac55ebb9932e5ab19fcf2e6eca7dd0)
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 *
e6ca0a57 36 * @var int
e501603b
TO
37 */
38 public $id;
c3fc2621 39
e501603b
TO
40 /**
41 * Location Type Name.
42 *
43 * @var string
44 */
45 public $name;
c3fc2621 46
e501603b
TO
47 /**
48 * Location Type Display Name.
49 *
50 * @var string
51 */
52 public $display_name;
c3fc2621 53
e501603b
TO
54 /**
55 * vCard Location Type Name.
56 *
57 * @var string
58 */
59 public $vcard_name;
c3fc2621 60
e501603b
TO
61 /**
62 * Location Type Description.
63 *
64 * @var string
65 */
66 public $description;
c3fc2621 67
e501603b
TO
68 /**
69 * Is this location type a predefined system location?
70 *
e6ca0a57 71 * @var bool
e501603b
TO
72 */
73 public $is_reserved;
c3fc2621 74
e501603b
TO
75 /**
76 * Is this property active?
77 *
e6ca0a57 78 * @var bool
e501603b
TO
79 */
80 public $is_active;
c3fc2621 81
e501603b
TO
82 /**
83 * Is this location type the default?
84 *
e6ca0a57 85 * @var bool
e501603b
TO
86 */
87 public $is_default;
c3fc2621 88
e501603b 89 /**
f41f0342 90 * Class constructor.
e501603b 91 */
c3fc2621 92 public function __construct() {
e501603b
TO
93 $this->__table = 'civicrm_location_type';
94 parent::__construct();
95 }
449c4e6b
CW
96
97 /**
98 * Returns localized title of this entity.
7b66c3b5
AH
99 *
100 * @param bool $plural
101 * Whether to return the plural version of the title.
449c4e6b 102 */
7b66c3b5
AH
103 public static function getEntityTitle($plural = FALSE) {
104 return $plural ? ts('Location Types') : ts('Location Type');
449c4e6b 105 }
c3fc2621 106
e501603b
TO
107 /**
108 * Returns all the column names of this table
109 *
110 * @return array
111 */
c3fc2621 112 public static function &fields() {
346aaaba 113 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
c3fc2621
CW
114 Civi::$statics[__CLASS__]['fields'] = [
115 'id' => [
e501603b
TO
116 'name' => 'id',
117 'type' => CRM_Utils_Type::T_INT,
c3fc2621 118 'title' => ts('Location Type ID'),
215b423e 119 'description' => ts('Location Type ID'),
c3fc2621 120 'required' => TRUE,
a36434b9 121 'where' => 'civicrm_location_type.id',
522a26c9 122 'table_name' => 'civicrm_location_type',
123 'entity' => 'LocationType',
124 'bao' => 'CRM_Core_BAO_LocationType',
6a7e5e5d 125 'localizable' => 0,
a9d0587b 126 'add' => '1.1',
c3fc2621
CW
127 ],
128 'name' => [
e501603b
TO
129 'name' => 'name',
130 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 131 'title' => ts('Location Type'),
215b423e 132 'description' => ts('Location Type Name.'),
e501603b
TO
133 'maxlength' => 64,
134 'size' => CRM_Utils_Type::BIG,
a36434b9 135 'where' => 'civicrm_location_type.name',
522a26c9 136 'table_name' => 'civicrm_location_type',
137 'entity' => 'LocationType',
138 'bao' => 'CRM_Core_BAO_LocationType',
6a7e5e5d 139 'localizable' => 0,
a9d0587b 140 'add' => '1.1',
c3fc2621
CW
141 ],
142 'display_name' => [
e501603b
TO
143 'name' => 'display_name',
144 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 145 'title' => ts('Display Name'),
215b423e 146 'description' => ts('Location Type Display Name.'),
e501603b
TO
147 'maxlength' => 64,
148 'size' => CRM_Utils_Type::BIG,
a36434b9 149 'where' => 'civicrm_location_type.display_name',
522a26c9 150 'table_name' => 'civicrm_location_type',
151 'entity' => 'LocationType',
152 'bao' => 'CRM_Core_BAO_LocationType',
6a7e5e5d 153 'localizable' => 1,
a9d0587b 154 'add' => '4.1',
c3fc2621
CW
155 ],
156 'vcard_name' => [
e501603b
TO
157 'name' => 'vcard_name',
158 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 159 'title' => ts('vCard Location Type'),
215b423e 160 'description' => ts('vCard Location Type Name.'),
e501603b
TO
161 'maxlength' => 64,
162 'size' => CRM_Utils_Type::BIG,
a36434b9 163 'where' => 'civicrm_location_type.vcard_name',
522a26c9 164 'table_name' => 'civicrm_location_type',
165 'entity' => 'LocationType',
166 'bao' => 'CRM_Core_BAO_LocationType',
6a7e5e5d 167 'localizable' => 0,
a9d0587b 168 'add' => '1.1',
c3fc2621
CW
169 ],
170 'description' => [
e501603b
TO
171 'name' => 'description',
172 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 173 'title' => ts('Description'),
215b423e 174 'description' => ts('Location Type Description.'),
e501603b
TO
175 'maxlength' => 255,
176 'size' => CRM_Utils_Type::HUGE,
a36434b9 177 'where' => 'civicrm_location_type.description',
522a26c9 178 'table_name' => 'civicrm_location_type',
179 'entity' => 'LocationType',
180 'bao' => 'CRM_Core_BAO_LocationType',
6a7e5e5d 181 'localizable' => 0,
a9d0587b 182 'add' => '1.1',
c3fc2621
CW
183 ],
184 'is_reserved' => [
e501603b
TO
185 'name' => 'is_reserved',
186 'type' => CRM_Utils_Type::T_BOOLEAN,
c3fc2621 187 'title' => ts('Location Type is Reserved?'),
215b423e 188 'description' => ts('Is this location type a predefined system location?'),
a36434b9 189 'where' => 'civicrm_location_type.is_reserved',
522a26c9 190 'table_name' => 'civicrm_location_type',
191 'entity' => 'LocationType',
192 'bao' => 'CRM_Core_BAO_LocationType',
6a7e5e5d 193 'localizable' => 0,
a9d0587b 194 'add' => '1.1',
c3fc2621
CW
195 ],
196 'is_active' => [
e501603b
TO
197 'name' => 'is_active',
198 'type' => CRM_Utils_Type::T_BOOLEAN,
c3fc2621 199 'title' => ts('Location Type is Active?'),
215b423e 200 'description' => ts('Is this property active?'),
a36434b9 201 'where' => 'civicrm_location_type.is_active',
522a26c9 202 'table_name' => 'civicrm_location_type',
203 'entity' => 'LocationType',
204 'bao' => 'CRM_Core_BAO_LocationType',
6a7e5e5d 205 'localizable' => 0,
a9d0587b 206 'add' => '1.1',
c3fc2621
CW
207 ],
208 'is_default' => [
e501603b
TO
209 'name' => 'is_default',
210 'type' => CRM_Utils_Type::T_BOOLEAN,
c3fc2621 211 'title' => ts('Default Location Type?'),
215b423e 212 'description' => ts('Is this location type the default?'),
a36434b9 213 'where' => 'civicrm_location_type.is_default',
522a26c9 214 'table_name' => 'civicrm_location_type',
215 'entity' => 'LocationType',
216 'bao' => 'CRM_Core_BAO_LocationType',
6a7e5e5d 217 'localizable' => 0,
a9d0587b 218 'add' => '1.1',
c3fc2621
CW
219 ],
220 ];
346aaaba 221 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
e501603b 222 }
346aaaba 223 return Civi::$statics[__CLASS__]['fields'];
e501603b 224 }
c3fc2621 225
e501603b 226 /**
bd8e0b14 227 * Return a mapping from field-name to the corresponding key (as used in fields()).
e501603b
TO
228 *
229 * @return array
bd8e0b14 230 * Array(string $name => string $uniqueName).
e501603b 231 */
c3fc2621 232 public static function &fieldKeys() {
bd8e0b14
TO
233 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
234 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
e501603b 235 }
bd8e0b14 236 return Civi::$statics[__CLASS__]['fieldKeys'];
e501603b 237 }
c3fc2621 238
e501603b
TO
239 /**
240 * Returns the names of this table
241 *
242 * @return string
243 */
c3fc2621 244 public static function getTableName() {
e501603b
TO
245 return CRM_Core_DAO::getLocaleTableName(self::$_tableName);
246 }
c3fc2621 247
e501603b
TO
248 /**
249 * Returns if this table needs to be logged
250 *
c3fc2621 251 * @return bool
e501603b 252 */
c3fc2621 253 public function getLog() {
e501603b
TO
254 return self::$_log;
255 }
c3fc2621 256
e501603b
TO
257 /**
258 * Returns the list of fields that can be imported
259 *
260 * @param bool $prefix
261 *
262 * @return array
263 */
c3fc2621
CW
264 public static function &import($prefix = FALSE) {
265 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'location_type', $prefix, []);
60808919 266 return $r;
e501603b 267 }
c3fc2621 268
e501603b
TO
269 /**
270 * Returns the list of fields that can be exported
271 *
272 * @param bool $prefix
273 *
274 * @return array
275 */
c3fc2621
CW
276 public static function &export($prefix = FALSE) {
277 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'location_type', $prefix, []);
60808919 278 return $r;
e501603b 279 }
c3fc2621 280
e7a6b91a
AS
281 /**
282 * Returns the list of indices
c3fc2621
CW
283 *
284 * @param bool $localize
285 *
286 * @return array
e7a6b91a
AS
287 */
288 public static function indices($localize = TRUE) {
c3fc2621
CW
289 $indices = [
290 'UI_name' => [
e7a6b91a 291 'name' => 'UI_name',
c3fc2621 292 'field' => [
e7a6b91a 293 0 => 'name',
c3fc2621
CW
294 ],
295 'localizable' => FALSE,
296 'unique' => TRUE,
e7a6b91a 297 'sig' => 'civicrm_location_type::1::name',
c3fc2621
CW
298 ],
299 ];
e7a6b91a
AS
300 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
301 }
c3fc2621 302
e501603b 303}