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