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