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