Merge pull request #19205 from eileenmcnaughton/mem_forms
[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:b61d71dabcb618c14e3e8d7985b324de)
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 'add' => '1.2',
185 ],
186 'mapping_id' => [
187 'name' => 'mapping_id',
188 'type' => CRM_Utils_Type::T_INT,
189 'title' => ts('Mapping ID'),
190 'description' => ts('Mapping to which this field belongs'),
191 'required' => TRUE,
192 'where' => 'civicrm_mapping_field.mapping_id',
193 'table_name' => 'civicrm_mapping_field',
194 'entity' => 'MappingField',
195 'bao' => 'CRM_Core_DAO_MappingField',
196 'localizable' => 0,
197 'FKClassName' => 'CRM_Core_DAO_Mapping',
198 'add' => '1.2',
199 ],
200 'name' => [
201 'name' => 'name',
202 'type' => CRM_Utils_Type::T_STRING,
203 'title' => ts('Field Name (or unique reference)'),
204 'description' => ts('Mapping field key'),
205 'maxlength' => 255,
206 'size' => CRM_Utils_Type::HUGE,
207 'where' => 'civicrm_mapping_field.name',
208 'table_name' => 'civicrm_mapping_field',
209 'entity' => 'MappingField',
210 'bao' => 'CRM_Core_DAO_MappingField',
211 'localizable' => 0,
212 'add' => '1.2',
213 ],
214 'contact_type' => [
215 'name' => 'contact_type',
216 'type' => CRM_Utils_Type::T_STRING,
217 'title' => ts('Contact Type'),
218 'description' => ts('Contact Type in mapping'),
219 'maxlength' => 64,
220 'size' => CRM_Utils_Type::BIG,
221 'where' => 'civicrm_mapping_field.contact_type',
222 'table_name' => 'civicrm_mapping_field',
223 'entity' => 'MappingField',
224 'bao' => 'CRM_Core_DAO_MappingField',
225 'localizable' => 0,
226 'html' => [
227 'type' => 'Select',
228 ],
229 'add' => '1.2',
230 ],
231 'column_number' => [
232 'name' => 'column_number',
233 'type' => CRM_Utils_Type::T_INT,
234 'title' => ts('Column Number to map to'),
235 'description' => ts('Column number for mapping set'),
236 'required' => TRUE,
237 'where' => 'civicrm_mapping_field.column_number',
238 'table_name' => 'civicrm_mapping_field',
239 'entity' => 'MappingField',
240 'bao' => 'CRM_Core_DAO_MappingField',
241 'localizable' => 0,
242 'add' => '1.2',
243 ],
244 'location_type_id' => [
245 'name' => 'location_type_id',
246 'type' => CRM_Utils_Type::T_INT,
247 'title' => ts('Location type ID'),
248 'description' => ts('Location type of this mapping, if required'),
249 'where' => 'civicrm_mapping_field.location_type_id',
250 'table_name' => 'civicrm_mapping_field',
251 'entity' => 'MappingField',
252 'bao' => 'CRM_Core_DAO_MappingField',
253 'localizable' => 0,
254 'FKClassName' => 'CRM_Core_DAO_LocationType',
255 'pseudoconstant' => [
256 'table' => 'civicrm_location_type',
257 'keyColumn' => 'id',
258 'labelColumn' => 'display_name',
259 ],
260 'add' => '1.2',
261 ],
262 'phone_type_id' => [
263 'name' => 'phone_type_id',
264 'type' => CRM_Utils_Type::T_INT,
265 'title' => ts('Phone Type'),
266 'description' => ts('Which type of phone does this number belongs.'),
267 'where' => 'civicrm_mapping_field.phone_type_id',
268 'table_name' => 'civicrm_mapping_field',
269 'entity' => 'MappingField',
270 'bao' => 'CRM_Core_DAO_MappingField',
271 'localizable' => 0,
272 'add' => '2.2',
273 ],
274 'im_provider_id' => [
275 'name' => 'im_provider_id',
276 'type' => CRM_Utils_Type::T_INT,
277 'title' => ts('IM provider ID'),
278 'description' => ts('Which type of IM Provider does this name belong.'),
279 'where' => 'civicrm_mapping_field.im_provider_id',
280 'table_name' => 'civicrm_mapping_field',
281 'entity' => 'MappingField',
282 'bao' => 'CRM_Core_DAO_MappingField',
283 'localizable' => 0,
284 'html' => [
285 'type' => 'Select',
286 ],
287 'pseudoconstant' => [
288 'optionGroupName' => 'instant_messenger_service',
289 'optionEditPath' => 'civicrm/admin/options/instant_messenger_service',
290 ],
291 'add' => '3.0',
292 ],
293 'website_type_id' => [
294 'name' => 'website_type_id',
295 'type' => CRM_Utils_Type::T_INT,
296 'title' => ts('Website type ID'),
297 'description' => ts('Which type of website does this site belong'),
298 'where' => 'civicrm_mapping_field.website_type_id',
299 'table_name' => 'civicrm_mapping_field',
300 'entity' => 'MappingField',
301 'bao' => 'CRM_Core_DAO_MappingField',
302 'localizable' => 0,
303 'html' => [
304 'type' => 'Select',
305 ],
306 'pseudoconstant' => [
307 'optionGroupName' => 'website_type',
308 'optionEditPath' => 'civicrm/admin/options/website_type',
309 ],
310 'add' => '3.2',
311 ],
312 'relationship_type_id' => [
313 'name' => 'relationship_type_id',
314 'type' => CRM_Utils_Type::T_INT,
315 'title' => ts('Relationship type ID'),
316 'description' => ts('Relationship type, if required'),
317 'where' => 'civicrm_mapping_field.relationship_type_id',
318 'table_name' => 'civicrm_mapping_field',
319 'entity' => 'MappingField',
320 'bao' => 'CRM_Core_DAO_MappingField',
321 'localizable' => 0,
322 'FKClassName' => 'CRM_Contact_DAO_RelationshipType',
323 'add' => '1.2',
324 ],
325 'relationship_direction' => [
326 'name' => 'relationship_direction',
327 'type' => CRM_Utils_Type::T_STRING,
328 'title' => ts('Relationship Direction'),
329 'maxlength' => 6,
330 'size' => CRM_Utils_Type::SIX,
331 'where' => 'civicrm_mapping_field.relationship_direction',
332 'table_name' => 'civicrm_mapping_field',
333 'entity' => 'MappingField',
334 'bao' => 'CRM_Core_DAO_MappingField',
335 'localizable' => 0,
336 'add' => '1.7',
337 ],
338 'grouping' => [
339 'name' => 'grouping',
340 'type' => CRM_Utils_Type::T_INT,
341 'title' => ts('Field Grouping'),
342 'description' => ts('Used to group mapping_field records into related sets (e.g. for criteria sets in search builder
343 mappings).'),
344 'where' => 'civicrm_mapping_field.grouping',
345 'default' => '1',
346 'table_name' => 'civicrm_mapping_field',
347 'entity' => 'MappingField',
348 'bao' => 'CRM_Core_DAO_MappingField',
349 'localizable' => 0,
350 'add' => '1.5',
351 ],
352 'operator' => [
353 'name' => 'operator',
354 'type' => CRM_Utils_Type::T_STRING,
355 'title' => ts('Operator'),
356 'description' => ts('SQL WHERE operator for search-builder mapping fields (search criteria).'),
357 'maxlength' => 16,
358 'size' => CRM_Utils_Type::TWELVE,
359 'where' => 'civicrm_mapping_field.operator',
360 'table_name' => 'civicrm_mapping_field',
361 'entity' => 'MappingField',
362 'bao' => 'CRM_Core_DAO_MappingField',
363 'localizable' => 0,
364 'html' => [
365 'type' => 'Select',
366 ],
367 'pseudoconstant' => [
368 'callback' => 'CRM_Core_SelectValues::getSearchBuilderOperators',
369 ],
370 'add' => '1.5',
371 ],
372 'value' => [
373 'name' => 'value',
374 'type' => CRM_Utils_Type::T_STRING,
375 'title' => ts('Search builder where clause'),
376 'description' => ts('SQL WHERE value for search-builder mapping fields.'),
377 'maxlength' => 255,
378 'size' => CRM_Utils_Type::HUGE,
379 'where' => 'civicrm_mapping_field.value',
380 'table_name' => 'civicrm_mapping_field',
381 'entity' => 'MappingField',
382 'bao' => 'CRM_Core_DAO_MappingField',
383 'localizable' => 0,
384 'add' => '1.5',
385 ],
386 ];
387 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
388 }
389 return Civi::$statics[__CLASS__]['fields'];
390 }
391
392 /**
393 * Return a mapping from field-name to the corresponding key (as used in fields()).
394 *
395 * @return array
396 * Array(string $name => string $uniqueName).
397 */
398 public static function &fieldKeys() {
399 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
400 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
401 }
402 return Civi::$statics[__CLASS__]['fieldKeys'];
403 }
404
405 /**
406 * Returns the names of this table
407 *
408 * @return string
409 */
410 public static function getTableName() {
411 return self::$_tableName;
412 }
413
414 /**
415 * Returns if this table needs to be logged
416 *
417 * @return bool
418 */
419 public function getLog() {
420 return self::$_log;
421 }
422
423 /**
424 * Returns the list of fields that can be imported
425 *
426 * @param bool $prefix
427 *
428 * @return array
429 */
430 public static function &import($prefix = FALSE) {
431 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'mapping_field', $prefix, []);
432 return $r;
433 }
434
435 /**
436 * Returns the list of fields that can be exported
437 *
438 * @param bool $prefix
439 *
440 * @return array
441 */
442 public static function &export($prefix = FALSE) {
443 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'mapping_field', $prefix, []);
444 return $r;
445 }
446
447 /**
448 * Returns the list of indices
449 *
450 * @param bool $localize
451 *
452 * @return array
453 */
454 public static function indices($localize = TRUE) {
455 $indices = [];
456 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
457 }
458
459 }