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