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