Add titles and icons to entities
[civicrm-core.git] / CRM / Core / DAO / MappingField.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/MappingField.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
449c4e6b 9 * (GenCodeChecksum:fdc6c79da7e1c0c60b5a5987ce42fd0d)
e501603b 10 */
c3fc2621 11
f41f0342 12/**
c3fc2621 13 * Database access object for the MappingField entity.
f41f0342 14 */
e501603b 15class CRM_Core_DAO_MappingField 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_mapping_field';
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 = FALSE;
c3fc2621 30
e501603b
TO
31 /**
32 * Mapping Field ID
33 *
e6ca0a57 34 * @var int
e501603b
TO
35 */
36 public $id;
c3fc2621 37
e501603b
TO
38 /**
39 * Mapping to which this field belongs
40 *
e6ca0a57 41 * @var int
e501603b
TO
42 */
43 public $mapping_id;
c3fc2621 44
e501603b
TO
45 /**
46 * Mapping field key
47 *
48 * @var string
49 */
50 public $name;
c3fc2621 51
e501603b
TO
52 /**
53 * Contact Type in mapping
54 *
55 * @var string
56 */
57 public $contact_type;
c3fc2621 58
e501603b
TO
59 /**
60 * Column number for mapping set
61 *
e6ca0a57 62 * @var int
e501603b
TO
63 */
64 public $column_number;
c3fc2621 65
e501603b
TO
66 /**
67 * Location type of this mapping, if required
68 *
e6ca0a57 69 * @var int
e501603b
TO
70 */
71 public $location_type_id;
c3fc2621 72
e501603b
TO
73 /**
74 * Which type of phone does this number belongs.
75 *
e6ca0a57 76 * @var int
e501603b
TO
77 */
78 public $phone_type_id;
c3fc2621 79
e501603b
TO
80 /**
81 * Which type of IM Provider does this name belong.
82 *
e6ca0a57 83 * @var int
e501603b
TO
84 */
85 public $im_provider_id;
c3fc2621 86
e501603b
TO
87 /**
88 * Which type of website does this site belong
89 *
e6ca0a57 90 * @var int
e501603b
TO
91 */
92 public $website_type_id;
c3fc2621 93
e501603b
TO
94 /**
95 * Relationship type, if required
96 *
e6ca0a57 97 * @var int
e501603b
TO
98 */
99 public $relationship_type_id;
c3fc2621 100
e501603b 101 /**
e501603b
TO
102 * @var string
103 */
104 public $relationship_direction;
c3fc2621 105
e501603b
TO
106 /**
107 * Used to group mapping_field records into related sets (e.g. for criteria sets in search builder
fb607354 108 * mappings).
e501603b 109 *
e6ca0a57 110 * @var int
e501603b
TO
111 */
112 public $grouping;
c3fc2621 113
e501603b
TO
114 /**
115 * SQL WHERE operator for search-builder mapping fields (search criteria).
116 *
117 * @var string
118 */
119 public $operator;
c3fc2621 120
e501603b
TO
121 /**
122 * SQL WHERE value for search-builder mapping fields.
123 *
124 * @var string
125 */
126 public $value;
c3fc2621 127
e501603b 128 /**
f41f0342 129 * Class constructor.
e501603b 130 */
c3fc2621 131 public function __construct() {
e501603b
TO
132 $this->__table = 'civicrm_mapping_field';
133 parent::__construct();
134 }
c3fc2621 135
449c4e6b
CW
136 /**
137 * Returns localized title of this entity.
138 */
139 public static function getEntityTitle() {
140 return ts('Mapping Fields');
141 }
142
e501603b 143 /**
f41f0342 144 * Returns foreign keys and entity references.
e501603b
TO
145 *
146 * @return array
147 * [CRM_Core_Reference_Interface]
148 */
c3fc2621 149 public static function getReferenceColumns() {
346aaaba 150 if (!isset(Civi::$statics[__CLASS__]['links'])) {
fa45b5b9 151 Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__);
c3fc2621
CW
152 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'mapping_id', 'civicrm_mapping', 'id');
153 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'location_type_id', 'civicrm_location_type', 'id');
154 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'relationship_type_id', 'civicrm_relationship_type', 'id');
346aaaba 155 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
e501603b 156 }
346aaaba 157 return Civi::$statics[__CLASS__]['links'];
e501603b 158 }
c3fc2621 159
e501603b
TO
160 /**
161 * Returns all the column names of this table
162 *
163 * @return array
164 */
c3fc2621 165 public static function &fields() {
346aaaba 166 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
c3fc2621
CW
167 Civi::$statics[__CLASS__]['fields'] = [
168 'id' => [
e501603b
TO
169 'name' => 'id',
170 'type' => CRM_Utils_Type::T_INT,
c3fc2621 171 'title' => ts('Mapping Field ID'),
215b423e 172 'description' => ts('Mapping Field ID'),
c3fc2621 173 'required' => TRUE,
a36434b9 174 'where' => 'civicrm_mapping_field.id',
522a26c9 175 'table_name' => 'civicrm_mapping_field',
176 'entity' => 'MappingField',
177 'bao' => 'CRM_Core_DAO_MappingField',
6a7e5e5d 178 'localizable' => 0,
c3fc2621
CW
179 ],
180 'mapping_id' => [
e501603b
TO
181 'name' => 'mapping_id',
182 'type' => CRM_Utils_Type::T_INT,
c3fc2621 183 'title' => ts('Mapping ID'),
215b423e 184 'description' => ts('Mapping to which this field belongs'),
c3fc2621 185 'required' => TRUE,
a36434b9 186 'where' => 'civicrm_mapping_field.mapping_id',
522a26c9 187 'table_name' => 'civicrm_mapping_field',
188 'entity' => 'MappingField',
189 'bao' => 'CRM_Core_DAO_MappingField',
6a7e5e5d 190 'localizable' => 0,
e501603b 191 'FKClassName' => 'CRM_Core_DAO_Mapping',
c3fc2621
CW
192 ],
193 'name' => [
e501603b
TO
194 'name' => 'name',
195 'type' => CRM_Utils_Type::T_STRING,
110684e4 196 'title' => ts('Field Name (or unique reference)'),
215b423e 197 'description' => ts('Mapping field key'),
e501603b
TO
198 'maxlength' => 255,
199 'size' => CRM_Utils_Type::HUGE,
a36434b9 200 'where' => 'civicrm_mapping_field.name',
522a26c9 201 'table_name' => 'civicrm_mapping_field',
202 'entity' => 'MappingField',
203 'bao' => 'CRM_Core_DAO_MappingField',
6a7e5e5d 204 'localizable' => 0,
c3fc2621
CW
205 ],
206 'contact_type' => [
e501603b
TO
207 'name' => 'contact_type',
208 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 209 'title' => ts('Contact Type'),
215b423e 210 'description' => ts('Contact Type in mapping'),
e501603b
TO
211 'maxlength' => 64,
212 'size' => CRM_Utils_Type::BIG,
a36434b9 213 'where' => 'civicrm_mapping_field.contact_type',
522a26c9 214 'table_name' => 'civicrm_mapping_field',
215 'entity' => 'MappingField',
216 'bao' => 'CRM_Core_DAO_MappingField',
6a7e5e5d 217 'localizable' => 0,
c3fc2621 218 'html' => [
e501603b 219 'type' => 'Select',
c3fc2621
CW
220 ],
221 ],
222 'column_number' => [
e501603b
TO
223 'name' => 'column_number',
224 'type' => CRM_Utils_Type::T_INT,
110684e4 225 'title' => ts('Column Number to map to'),
215b423e 226 'description' => ts('Column number for mapping set'),
c3fc2621 227 'required' => TRUE,
a36434b9 228 'where' => 'civicrm_mapping_field.column_number',
522a26c9 229 'table_name' => 'civicrm_mapping_field',
230 'entity' => 'MappingField',
231 'bao' => 'CRM_Core_DAO_MappingField',
6a7e5e5d 232 'localizable' => 0,
c3fc2621
CW
233 ],
234 'location_type_id' => [
e501603b
TO
235 'name' => 'location_type_id',
236 'type' => CRM_Utils_Type::T_INT,
c3fc2621 237 'title' => ts('Location type ID'),
215b423e 238 'description' => ts('Location type of this mapping, if required'),
a36434b9 239 'where' => 'civicrm_mapping_field.location_type_id',
522a26c9 240 'table_name' => 'civicrm_mapping_field',
241 'entity' => 'MappingField',
242 'bao' => 'CRM_Core_DAO_MappingField',
6a7e5e5d 243 'localizable' => 0,
e501603b 244 'FKClassName' => 'CRM_Core_DAO_LocationType',
3c5a48c7 245 'pseudoconstant' => [
246 'table' => 'civicrm_location_type',
247 'keyColumn' => 'id',
248 'labelColumn' => 'display_name',
249 ],
c3fc2621
CW
250 ],
251 'phone_type_id' => [
e501603b
TO
252 'name' => 'phone_type_id',
253 'type' => CRM_Utils_Type::T_INT,
110684e4 254 'title' => ts('Phone Type'),
215b423e 255 'description' => ts('Which type of phone does this number belongs.'),
a36434b9 256 'where' => 'civicrm_mapping_field.phone_type_id',
522a26c9 257 'table_name' => 'civicrm_mapping_field',
258 'entity' => 'MappingField',
259 'bao' => 'CRM_Core_DAO_MappingField',
6a7e5e5d 260 'localizable' => 0,
c3fc2621
CW
261 ],
262 'im_provider_id' => [
e501603b
TO
263 'name' => 'im_provider_id',
264 'type' => CRM_Utils_Type::T_INT,
c3fc2621 265 'title' => ts('IM provider ID'),
215b423e 266 'description' => ts('Which type of IM Provider does this name belong.'),
a36434b9 267 'where' => 'civicrm_mapping_field.im_provider_id',
522a26c9 268 'table_name' => 'civicrm_mapping_field',
269 'entity' => 'MappingField',
270 'bao' => 'CRM_Core_DAO_MappingField',
6a7e5e5d 271 'localizable' => 0,
c3fc2621 272 'html' => [
e501603b 273 'type' => 'Select',
c3fc2621
CW
274 ],
275 'pseudoconstant' => [
e501603b
TO
276 'optionGroupName' => 'instant_messenger_service',
277 'optionEditPath' => 'civicrm/admin/options/instant_messenger_service',
e6ca0a57 278 ],
c3fc2621
CW
279 ],
280 'website_type_id' => [
e501603b
TO
281 'name' => 'website_type_id',
282 'type' => CRM_Utils_Type::T_INT,
c3fc2621 283 'title' => ts('Website type ID'),
215b423e 284 'description' => ts('Which type of website does this site belong'),
a36434b9 285 'where' => 'civicrm_mapping_field.website_type_id',
522a26c9 286 'table_name' => 'civicrm_mapping_field',
287 'entity' => 'MappingField',
288 'bao' => 'CRM_Core_DAO_MappingField',
6a7e5e5d 289 'localizable' => 0,
c3fc2621 290 'html' => [
e501603b 291 'type' => 'Select',
c3fc2621
CW
292 ],
293 'pseudoconstant' => [
e501603b
TO
294 'optionGroupName' => 'website_type',
295 'optionEditPath' => 'civicrm/admin/options/website_type',
e6ca0a57 296 ],
c3fc2621
CW
297 ],
298 'relationship_type_id' => [
e501603b
TO
299 'name' => 'relationship_type_id',
300 'type' => CRM_Utils_Type::T_INT,
c3fc2621 301 'title' => ts('Relationship type ID'),
215b423e 302 'description' => ts('Relationship type, if required'),
a36434b9 303 'where' => 'civicrm_mapping_field.relationship_type_id',
522a26c9 304 'table_name' => 'civicrm_mapping_field',
305 'entity' => 'MappingField',
306 'bao' => 'CRM_Core_DAO_MappingField',
6a7e5e5d 307 'localizable' => 0,
e501603b 308 'FKClassName' => 'CRM_Contact_DAO_RelationshipType',
c3fc2621
CW
309 ],
310 'relationship_direction' => [
e501603b
TO
311 'name' => 'relationship_direction',
312 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 313 'title' => ts('Relationship Direction'),
e501603b
TO
314 'maxlength' => 6,
315 'size' => CRM_Utils_Type::SIX,
a36434b9 316 'where' => 'civicrm_mapping_field.relationship_direction',
522a26c9 317 'table_name' => 'civicrm_mapping_field',
318 'entity' => 'MappingField',
319 'bao' => 'CRM_Core_DAO_MappingField',
6a7e5e5d 320 'localizable' => 0,
c3fc2621
CW
321 ],
322 'grouping' => [
e501603b
TO
323 'name' => 'grouping',
324 'type' => CRM_Utils_Type::T_INT,
110684e4 325 'title' => ts('Field Grouping'),
215b423e 326 'description' => ts('Used to group mapping_field records into related sets (e.g. for criteria sets in search builder
fb607354 327 mappings).'),
a36434b9 328 'where' => 'civicrm_mapping_field.grouping',
e501603b 329 'default' => '1',
522a26c9 330 'table_name' => 'civicrm_mapping_field',
331 'entity' => 'MappingField',
332 'bao' => 'CRM_Core_DAO_MappingField',
6a7e5e5d 333 'localizable' => 0,
c3fc2621
CW
334 ],
335 'operator' => [
e501603b
TO
336 'name' => 'operator',
337 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 338 'title' => ts('Operator'),
215b423e 339 'description' => ts('SQL WHERE operator for search-builder mapping fields (search criteria).'),
e501603b
TO
340 'maxlength' => 16,
341 'size' => CRM_Utils_Type::TWELVE,
a36434b9 342 'where' => 'civicrm_mapping_field.operator',
522a26c9 343 'table_name' => 'civicrm_mapping_field',
344 'entity' => 'MappingField',
345 'bao' => 'CRM_Core_DAO_MappingField',
6a7e5e5d 346 'localizable' => 0,
c3fc2621 347 'html' => [
e501603b 348 'type' => 'Select',
c3fc2621
CW
349 ],
350 'pseudoconstant' => [
e501603b 351 'callback' => 'CRM_Core_SelectValues::getSearchBuilderOperators',
e6ca0a57 352 ],
c3fc2621
CW
353 ],
354 'value' => [
e501603b
TO
355 'name' => 'value',
356 'type' => CRM_Utils_Type::T_STRING,
110684e4 357 'title' => ts('Search builder where clause'),
215b423e 358 'description' => ts('SQL WHERE value for search-builder mapping fields.'),
e501603b
TO
359 'maxlength' => 255,
360 'size' => CRM_Utils_Type::HUGE,
a36434b9 361 'where' => 'civicrm_mapping_field.value',
522a26c9 362 'table_name' => 'civicrm_mapping_field',
363 'entity' => 'MappingField',
364 'bao' => 'CRM_Core_DAO_MappingField',
6a7e5e5d 365 'localizable' => 0,
c3fc2621
CW
366 ],
367 ];
346aaaba 368 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
e501603b 369 }
346aaaba 370 return Civi::$statics[__CLASS__]['fields'];
e501603b 371 }
c3fc2621 372
e501603b 373 /**
bd8e0b14 374 * Return a mapping from field-name to the corresponding key (as used in fields()).
e501603b
TO
375 *
376 * @return array
bd8e0b14 377 * Array(string $name => string $uniqueName).
e501603b 378 */
c3fc2621 379 public static function &fieldKeys() {
bd8e0b14
TO
380 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
381 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
e501603b 382 }
bd8e0b14 383 return Civi::$statics[__CLASS__]['fieldKeys'];
e501603b 384 }
c3fc2621 385
e501603b
TO
386 /**
387 * Returns the names of this table
388 *
389 * @return string
390 */
c3fc2621 391 public static function getTableName() {
e501603b
TO
392 return self::$_tableName;
393 }
c3fc2621 394
e501603b
TO
395 /**
396 * Returns if this table needs to be logged
397 *
c3fc2621 398 * @return bool
e501603b 399 */
c3fc2621 400 public function getLog() {
e501603b
TO
401 return self::$_log;
402 }
c3fc2621 403
e501603b
TO
404 /**
405 * Returns the list of fields that can be imported
406 *
407 * @param bool $prefix
408 *
409 * @return array
410 */
c3fc2621
CW
411 public static function &import($prefix = FALSE) {
412 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'mapping_field', $prefix, []);
60808919 413 return $r;
e501603b 414 }
c3fc2621 415
e501603b
TO
416 /**
417 * Returns the list of fields that can be exported
418 *
419 * @param bool $prefix
420 *
421 * @return array
422 */
c3fc2621
CW
423 public static function &export($prefix = FALSE) {
424 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'mapping_field', $prefix, []);
60808919 425 return $r;
e501603b 426 }
c3fc2621 427
e7a6b91a
AS
428 /**
429 * Returns the list of indices
c3fc2621
CW
430 *
431 * @param bool $localize
432 *
433 * @return array
e7a6b91a
AS
434 */
435 public static function indices($localize = TRUE) {
c3fc2621 436 $indices = [];
e7a6b91a
AS
437 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
438 }
c3fc2621 439
e501603b 440}