Merge pull request #2 from civicrm/master
[civicrm-core.git] / CRM / Core / DAO / LocationType.php
CommitLineData
e501603b 1<?php
c3fc2621 2
e501603b
TO
3/**
4 * @package CRM
6b83d5bd 5 * @copyright CiviCRM LLC (c) 2004-2019
e501603b
TO
6 *
7 * Generated from xml/schema/CRM/Core/LocationType.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
e6ca0a57 9 * (GenCodeChecksum:aa147acf0dac148b113c33d4ca12876c)
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 {
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 }
c3fc2621 94
e501603b
TO
95 /**
96 * Returns all the column names of this table
97 *
98 * @return array
99 */
c3fc2621 100 public static function &fields() {
346aaaba 101 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
c3fc2621
CW
102 Civi::$statics[__CLASS__]['fields'] = [
103 'id' => [
e501603b
TO
104 'name' => 'id',
105 'type' => CRM_Utils_Type::T_INT,
c3fc2621 106 'title' => ts('Location Type ID'),
215b423e 107 'description' => ts('Location Type ID'),
c3fc2621 108 'required' => TRUE,
a36434b9 109 'where' => 'civicrm_location_type.id',
522a26c9 110 'table_name' => 'civicrm_location_type',
111 'entity' => 'LocationType',
112 'bao' => 'CRM_Core_BAO_LocationType',
6a7e5e5d 113 'localizable' => 0,
c3fc2621
CW
114 ],
115 'name' => [
e501603b
TO
116 'name' => 'name',
117 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 118 'title' => ts('Location Type'),
215b423e 119 'description' => ts('Location Type Name.'),
e501603b
TO
120 'maxlength' => 64,
121 'size' => CRM_Utils_Type::BIG,
a36434b9 122 'where' => 'civicrm_location_type.name',
522a26c9 123 'table_name' => 'civicrm_location_type',
124 'entity' => 'LocationType',
125 'bao' => 'CRM_Core_BAO_LocationType',
6a7e5e5d 126 'localizable' => 0,
c3fc2621
CW
127 ],
128 'display_name' => [
e501603b
TO
129 'name' => 'display_name',
130 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 131 'title' => ts('Display Name'),
215b423e 132 'description' => ts('Location Type Display Name.'),
e501603b
TO
133 'maxlength' => 64,
134 'size' => CRM_Utils_Type::BIG,
a36434b9 135 'where' => 'civicrm_location_type.display_name',
522a26c9 136 'table_name' => 'civicrm_location_type',
137 'entity' => 'LocationType',
138 'bao' => 'CRM_Core_BAO_LocationType',
6a7e5e5d 139 'localizable' => 1,
c3fc2621
CW
140 ],
141 'vcard_name' => [
e501603b
TO
142 'name' => 'vcard_name',
143 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 144 'title' => ts('vCard Location Type'),
215b423e 145 'description' => ts('vCard Location Type Name.'),
e501603b
TO
146 'maxlength' => 64,
147 'size' => CRM_Utils_Type::BIG,
a36434b9 148 'where' => 'civicrm_location_type.vcard_name',
522a26c9 149 'table_name' => 'civicrm_location_type',
150 'entity' => 'LocationType',
151 'bao' => 'CRM_Core_BAO_LocationType',
6a7e5e5d 152 'localizable' => 0,
c3fc2621
CW
153 ],
154 'description' => [
e501603b
TO
155 'name' => 'description',
156 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 157 'title' => ts('Description'),
215b423e 158 'description' => ts('Location Type Description.'),
e501603b
TO
159 'maxlength' => 255,
160 'size' => CRM_Utils_Type::HUGE,
a36434b9 161 'where' => 'civicrm_location_type.description',
522a26c9 162 'table_name' => 'civicrm_location_type',
163 'entity' => 'LocationType',
164 'bao' => 'CRM_Core_BAO_LocationType',
6a7e5e5d 165 'localizable' => 0,
c3fc2621
CW
166 ],
167 'is_reserved' => [
e501603b
TO
168 'name' => 'is_reserved',
169 'type' => CRM_Utils_Type::T_BOOLEAN,
c3fc2621 170 'title' => ts('Location Type is Reserved?'),
215b423e 171 'description' => ts('Is this location type a predefined system location?'),
a36434b9 172 'where' => 'civicrm_location_type.is_reserved',
522a26c9 173 'table_name' => 'civicrm_location_type',
174 'entity' => 'LocationType',
175 'bao' => 'CRM_Core_BAO_LocationType',
6a7e5e5d 176 'localizable' => 0,
c3fc2621
CW
177 ],
178 'is_active' => [
e501603b
TO
179 'name' => 'is_active',
180 'type' => CRM_Utils_Type::T_BOOLEAN,
c3fc2621 181 'title' => ts('Location Type is Active?'),
215b423e 182 'description' => ts('Is this property active?'),
a36434b9 183 'where' => 'civicrm_location_type.is_active',
522a26c9 184 'table_name' => 'civicrm_location_type',
185 'entity' => 'LocationType',
186 'bao' => 'CRM_Core_BAO_LocationType',
6a7e5e5d 187 'localizable' => 0,
c3fc2621
CW
188 ],
189 'is_default' => [
e501603b
TO
190 'name' => 'is_default',
191 'type' => CRM_Utils_Type::T_BOOLEAN,
c3fc2621 192 'title' => ts('Default Location Type?'),
215b423e 193 'description' => ts('Is this location type the default?'),
a36434b9 194 'where' => 'civicrm_location_type.is_default',
522a26c9 195 'table_name' => 'civicrm_location_type',
196 'entity' => 'LocationType',
197 'bao' => 'CRM_Core_BAO_LocationType',
6a7e5e5d 198 'localizable' => 0,
c3fc2621
CW
199 ],
200 ];
346aaaba 201 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
e501603b 202 }
346aaaba 203 return Civi::$statics[__CLASS__]['fields'];
e501603b 204 }
c3fc2621 205
e501603b 206 /**
bd8e0b14 207 * Return a mapping from field-name to the corresponding key (as used in fields()).
e501603b
TO
208 *
209 * @return array
bd8e0b14 210 * Array(string $name => string $uniqueName).
e501603b 211 */
c3fc2621 212 public static function &fieldKeys() {
bd8e0b14
TO
213 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
214 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
e501603b 215 }
bd8e0b14 216 return Civi::$statics[__CLASS__]['fieldKeys'];
e501603b 217 }
c3fc2621 218
e501603b
TO
219 /**
220 * Returns the names of this table
221 *
222 * @return string
223 */
c3fc2621 224 public static function getTableName() {
e501603b
TO
225 return CRM_Core_DAO::getLocaleTableName(self::$_tableName);
226 }
c3fc2621 227
e501603b
TO
228 /**
229 * Returns if this table needs to be logged
230 *
c3fc2621 231 * @return bool
e501603b 232 */
c3fc2621 233 public function getLog() {
e501603b
TO
234 return self::$_log;
235 }
c3fc2621 236
e501603b
TO
237 /**
238 * Returns the list of fields that can be imported
239 *
240 * @param bool $prefix
241 *
242 * @return array
243 */
c3fc2621
CW
244 public static function &import($prefix = FALSE) {
245 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'location_type', $prefix, []);
60808919 246 return $r;
e501603b 247 }
c3fc2621 248
e501603b
TO
249 /**
250 * Returns the list of fields that can be exported
251 *
252 * @param bool $prefix
253 *
254 * @return array
255 */
c3fc2621
CW
256 public static function &export($prefix = FALSE) {
257 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'location_type', $prefix, []);
60808919 258 return $r;
e501603b 259 }
c3fc2621 260
e7a6b91a
AS
261 /**
262 * Returns the list of indices
c3fc2621
CW
263 *
264 * @param bool $localize
265 *
266 * @return array
e7a6b91a
AS
267 */
268 public static function indices($localize = TRUE) {
c3fc2621
CW
269 $indices = [
270 'UI_name' => [
e7a6b91a 271 'name' => 'UI_name',
c3fc2621 272 'field' => [
e7a6b91a 273 0 => 'name',
c3fc2621
CW
274 ],
275 'localizable' => FALSE,
276 'unique' => TRUE,
e7a6b91a 277 'sig' => 'civicrm_location_type::1::name',
c3fc2621
CW
278 ],
279 ];
e7a6b91a
AS
280 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
281 }
c3fc2621 282
e501603b 283}