Commit | Line | Data |
---|---|---|
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 | |
3c5a48c7 | 9 | * (GenCodeChecksum:11ff525a557ec58ebfa4fed22af699ea) |
e501603b | 10 | */ |
c3fc2621 | 11 | |
f41f0342 | 12 | /** |
c3fc2621 | 13 | * Database access object for the MappingField entity. |
f41f0342 | 14 | */ |
e501603b | 15 | class 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 | |
e501603b | 136 | /** |
f41f0342 | 137 | * Returns foreign keys and entity references. |
e501603b TO |
138 | * |
139 | * @return array | |
140 | * [CRM_Core_Reference_Interface] | |
141 | */ | |
c3fc2621 | 142 | public static function getReferenceColumns() { |
346aaaba | 143 | if (!isset(Civi::$statics[__CLASS__]['links'])) { |
fa45b5b9 | 144 | Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__); |
c3fc2621 CW |
145 | Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'mapping_id', 'civicrm_mapping', 'id'); |
146 | Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'location_type_id', 'civicrm_location_type', 'id'); | |
147 | Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'relationship_type_id', 'civicrm_relationship_type', 'id'); | |
346aaaba | 148 | CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']); |
e501603b | 149 | } |
346aaaba | 150 | return Civi::$statics[__CLASS__]['links']; |
e501603b | 151 | } |
c3fc2621 | 152 | |
e501603b TO |
153 | /** |
154 | * Returns all the column names of this table | |
155 | * | |
156 | * @return array | |
157 | */ | |
c3fc2621 | 158 | public static function &fields() { |
346aaaba | 159 | if (!isset(Civi::$statics[__CLASS__]['fields'])) { |
c3fc2621 CW |
160 | Civi::$statics[__CLASS__]['fields'] = [ |
161 | 'id' => [ | |
e501603b TO |
162 | 'name' => 'id', |
163 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 164 | 'title' => ts('Mapping Field ID'), |
215b423e | 165 | 'description' => ts('Mapping Field ID'), |
c3fc2621 | 166 | 'required' => TRUE, |
a36434b9 | 167 | 'where' => 'civicrm_mapping_field.id', |
522a26c9 | 168 | 'table_name' => 'civicrm_mapping_field', |
169 | 'entity' => 'MappingField', | |
170 | 'bao' => 'CRM_Core_DAO_MappingField', | |
6a7e5e5d | 171 | 'localizable' => 0, |
c3fc2621 CW |
172 | ], |
173 | 'mapping_id' => [ | |
e501603b TO |
174 | 'name' => 'mapping_id', |
175 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 176 | 'title' => ts('Mapping ID'), |
215b423e | 177 | 'description' => ts('Mapping to which this field belongs'), |
c3fc2621 | 178 | 'required' => TRUE, |
a36434b9 | 179 | 'where' => 'civicrm_mapping_field.mapping_id', |
522a26c9 | 180 | 'table_name' => 'civicrm_mapping_field', |
181 | 'entity' => 'MappingField', | |
182 | 'bao' => 'CRM_Core_DAO_MappingField', | |
6a7e5e5d | 183 | 'localizable' => 0, |
e501603b | 184 | 'FKClassName' => 'CRM_Core_DAO_Mapping', |
c3fc2621 CW |
185 | ], |
186 | 'name' => [ | |
e501603b TO |
187 | 'name' => 'name', |
188 | 'type' => CRM_Utils_Type::T_STRING, | |
110684e4 | 189 | 'title' => ts('Field Name (or unique reference)'), |
215b423e | 190 | 'description' => ts('Mapping field key'), |
e501603b TO |
191 | 'maxlength' => 255, |
192 | 'size' => CRM_Utils_Type::HUGE, | |
a36434b9 | 193 | 'where' => 'civicrm_mapping_field.name', |
522a26c9 | 194 | 'table_name' => 'civicrm_mapping_field', |
195 | 'entity' => 'MappingField', | |
196 | 'bao' => 'CRM_Core_DAO_MappingField', | |
6a7e5e5d | 197 | 'localizable' => 0, |
c3fc2621 CW |
198 | ], |
199 | 'contact_type' => [ | |
e501603b TO |
200 | 'name' => 'contact_type', |
201 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 202 | 'title' => ts('Contact Type'), |
215b423e | 203 | 'description' => ts('Contact Type in mapping'), |
e501603b TO |
204 | 'maxlength' => 64, |
205 | 'size' => CRM_Utils_Type::BIG, | |
a36434b9 | 206 | 'where' => 'civicrm_mapping_field.contact_type', |
522a26c9 | 207 | 'table_name' => 'civicrm_mapping_field', |
208 | 'entity' => 'MappingField', | |
209 | 'bao' => 'CRM_Core_DAO_MappingField', | |
6a7e5e5d | 210 | 'localizable' => 0, |
c3fc2621 | 211 | 'html' => [ |
e501603b | 212 | 'type' => 'Select', |
c3fc2621 CW |
213 | ], |
214 | ], | |
215 | 'column_number' => [ | |
e501603b TO |
216 | 'name' => 'column_number', |
217 | 'type' => CRM_Utils_Type::T_INT, | |
110684e4 | 218 | 'title' => ts('Column Number to map to'), |
215b423e | 219 | 'description' => ts('Column number for mapping set'), |
c3fc2621 | 220 | 'required' => TRUE, |
a36434b9 | 221 | 'where' => 'civicrm_mapping_field.column_number', |
522a26c9 | 222 | 'table_name' => 'civicrm_mapping_field', |
223 | 'entity' => 'MappingField', | |
224 | 'bao' => 'CRM_Core_DAO_MappingField', | |
6a7e5e5d | 225 | 'localizable' => 0, |
c3fc2621 CW |
226 | ], |
227 | 'location_type_id' => [ | |
e501603b TO |
228 | 'name' => 'location_type_id', |
229 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 230 | 'title' => ts('Location type ID'), |
215b423e | 231 | 'description' => ts('Location type of this mapping, if required'), |
a36434b9 | 232 | 'where' => 'civicrm_mapping_field.location_type_id', |
522a26c9 | 233 | 'table_name' => 'civicrm_mapping_field', |
234 | 'entity' => 'MappingField', | |
235 | 'bao' => 'CRM_Core_DAO_MappingField', | |
6a7e5e5d | 236 | 'localizable' => 0, |
e501603b | 237 | 'FKClassName' => 'CRM_Core_DAO_LocationType', |
3c5a48c7 | 238 | 'pseudoconstant' => [ |
239 | 'table' => 'civicrm_location_type', | |
240 | 'keyColumn' => 'id', | |
241 | 'labelColumn' => 'display_name', | |
242 | ], | |
c3fc2621 CW |
243 | ], |
244 | 'phone_type_id' => [ | |
e501603b TO |
245 | 'name' => 'phone_type_id', |
246 | 'type' => CRM_Utils_Type::T_INT, | |
110684e4 | 247 | 'title' => ts('Phone Type'), |
215b423e | 248 | 'description' => ts('Which type of phone does this number belongs.'), |
a36434b9 | 249 | 'where' => 'civicrm_mapping_field.phone_type_id', |
522a26c9 | 250 | 'table_name' => 'civicrm_mapping_field', |
251 | 'entity' => 'MappingField', | |
252 | 'bao' => 'CRM_Core_DAO_MappingField', | |
6a7e5e5d | 253 | 'localizable' => 0, |
c3fc2621 CW |
254 | ], |
255 | 'im_provider_id' => [ | |
e501603b TO |
256 | 'name' => 'im_provider_id', |
257 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 258 | 'title' => ts('IM provider ID'), |
215b423e | 259 | 'description' => ts('Which type of IM Provider does this name belong.'), |
a36434b9 | 260 | 'where' => 'civicrm_mapping_field.im_provider_id', |
522a26c9 | 261 | 'table_name' => 'civicrm_mapping_field', |
262 | 'entity' => 'MappingField', | |
263 | 'bao' => 'CRM_Core_DAO_MappingField', | |
6a7e5e5d | 264 | 'localizable' => 0, |
c3fc2621 | 265 | 'html' => [ |
e501603b | 266 | 'type' => 'Select', |
c3fc2621 CW |
267 | ], |
268 | 'pseudoconstant' => [ | |
e501603b TO |
269 | 'optionGroupName' => 'instant_messenger_service', |
270 | 'optionEditPath' => 'civicrm/admin/options/instant_messenger_service', | |
e6ca0a57 | 271 | ], |
c3fc2621 CW |
272 | ], |
273 | 'website_type_id' => [ | |
e501603b TO |
274 | 'name' => 'website_type_id', |
275 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 276 | 'title' => ts('Website type ID'), |
215b423e | 277 | 'description' => ts('Which type of website does this site belong'), |
a36434b9 | 278 | 'where' => 'civicrm_mapping_field.website_type_id', |
522a26c9 | 279 | 'table_name' => 'civicrm_mapping_field', |
280 | 'entity' => 'MappingField', | |
281 | 'bao' => 'CRM_Core_DAO_MappingField', | |
6a7e5e5d | 282 | 'localizable' => 0, |
c3fc2621 | 283 | 'html' => [ |
e501603b | 284 | 'type' => 'Select', |
c3fc2621 CW |
285 | ], |
286 | 'pseudoconstant' => [ | |
e501603b TO |
287 | 'optionGroupName' => 'website_type', |
288 | 'optionEditPath' => 'civicrm/admin/options/website_type', | |
e6ca0a57 | 289 | ], |
c3fc2621 CW |
290 | ], |
291 | 'relationship_type_id' => [ | |
e501603b TO |
292 | 'name' => 'relationship_type_id', |
293 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 294 | 'title' => ts('Relationship type ID'), |
215b423e | 295 | 'description' => ts('Relationship type, if required'), |
a36434b9 | 296 | 'where' => 'civicrm_mapping_field.relationship_type_id', |
522a26c9 | 297 | 'table_name' => 'civicrm_mapping_field', |
298 | 'entity' => 'MappingField', | |
299 | 'bao' => 'CRM_Core_DAO_MappingField', | |
6a7e5e5d | 300 | 'localizable' => 0, |
e501603b | 301 | 'FKClassName' => 'CRM_Contact_DAO_RelationshipType', |
c3fc2621 CW |
302 | ], |
303 | 'relationship_direction' => [ | |
e501603b TO |
304 | 'name' => 'relationship_direction', |
305 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 306 | 'title' => ts('Relationship Direction'), |
e501603b TO |
307 | 'maxlength' => 6, |
308 | 'size' => CRM_Utils_Type::SIX, | |
a36434b9 | 309 | 'where' => 'civicrm_mapping_field.relationship_direction', |
522a26c9 | 310 | 'table_name' => 'civicrm_mapping_field', |
311 | 'entity' => 'MappingField', | |
312 | 'bao' => 'CRM_Core_DAO_MappingField', | |
6a7e5e5d | 313 | 'localizable' => 0, |
c3fc2621 CW |
314 | ], |
315 | 'grouping' => [ | |
e501603b TO |
316 | 'name' => 'grouping', |
317 | 'type' => CRM_Utils_Type::T_INT, | |
110684e4 | 318 | 'title' => ts('Field Grouping'), |
215b423e | 319 | 'description' => ts('Used to group mapping_field records into related sets (e.g. for criteria sets in search builder |
fb607354 | 320 | mappings).'), |
a36434b9 | 321 | 'where' => 'civicrm_mapping_field.grouping', |
e501603b | 322 | 'default' => '1', |
522a26c9 | 323 | 'table_name' => 'civicrm_mapping_field', |
324 | 'entity' => 'MappingField', | |
325 | 'bao' => 'CRM_Core_DAO_MappingField', | |
6a7e5e5d | 326 | 'localizable' => 0, |
c3fc2621 CW |
327 | ], |
328 | 'operator' => [ | |
e501603b TO |
329 | 'name' => 'operator', |
330 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 331 | 'title' => ts('Operator'), |
215b423e | 332 | 'description' => ts('SQL WHERE operator for search-builder mapping fields (search criteria).'), |
e501603b TO |
333 | 'maxlength' => 16, |
334 | 'size' => CRM_Utils_Type::TWELVE, | |
a36434b9 | 335 | 'where' => 'civicrm_mapping_field.operator', |
522a26c9 | 336 | 'table_name' => 'civicrm_mapping_field', |
337 | 'entity' => 'MappingField', | |
338 | 'bao' => 'CRM_Core_DAO_MappingField', | |
6a7e5e5d | 339 | 'localizable' => 0, |
c3fc2621 | 340 | 'html' => [ |
e501603b | 341 | 'type' => 'Select', |
c3fc2621 CW |
342 | ], |
343 | 'pseudoconstant' => [ | |
e501603b | 344 | 'callback' => 'CRM_Core_SelectValues::getSearchBuilderOperators', |
e6ca0a57 | 345 | ], |
c3fc2621 CW |
346 | ], |
347 | 'value' => [ | |
e501603b TO |
348 | 'name' => 'value', |
349 | 'type' => CRM_Utils_Type::T_STRING, | |
110684e4 | 350 | 'title' => ts('Search builder where clause'), |
215b423e | 351 | 'description' => ts('SQL WHERE value for search-builder mapping fields.'), |
e501603b TO |
352 | 'maxlength' => 255, |
353 | 'size' => CRM_Utils_Type::HUGE, | |
a36434b9 | 354 | 'where' => 'civicrm_mapping_field.value', |
522a26c9 | 355 | 'table_name' => 'civicrm_mapping_field', |
356 | 'entity' => 'MappingField', | |
357 | 'bao' => 'CRM_Core_DAO_MappingField', | |
6a7e5e5d | 358 | 'localizable' => 0, |
c3fc2621 CW |
359 | ], |
360 | ]; | |
346aaaba | 361 | CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); |
e501603b | 362 | } |
346aaaba | 363 | return Civi::$statics[__CLASS__]['fields']; |
e501603b | 364 | } |
c3fc2621 | 365 | |
e501603b | 366 | /** |
bd8e0b14 | 367 | * Return a mapping from field-name to the corresponding key (as used in fields()). |
e501603b TO |
368 | * |
369 | * @return array | |
bd8e0b14 | 370 | * Array(string $name => string $uniqueName). |
e501603b | 371 | */ |
c3fc2621 | 372 | public static function &fieldKeys() { |
bd8e0b14 TO |
373 | if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { |
374 | Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); | |
e501603b | 375 | } |
bd8e0b14 | 376 | return Civi::$statics[__CLASS__]['fieldKeys']; |
e501603b | 377 | } |
c3fc2621 | 378 | |
e501603b TO |
379 | /** |
380 | * Returns the names of this table | |
381 | * | |
382 | * @return string | |
383 | */ | |
c3fc2621 | 384 | public static function getTableName() { |
e501603b TO |
385 | return self::$_tableName; |
386 | } | |
c3fc2621 | 387 | |
e501603b TO |
388 | /** |
389 | * Returns if this table needs to be logged | |
390 | * | |
c3fc2621 | 391 | * @return bool |
e501603b | 392 | */ |
c3fc2621 | 393 | public function getLog() { |
e501603b TO |
394 | return self::$_log; |
395 | } | |
c3fc2621 | 396 | |
e501603b TO |
397 | /** |
398 | * Returns the list of fields that can be imported | |
399 | * | |
400 | * @param bool $prefix | |
401 | * | |
402 | * @return array | |
403 | */ | |
c3fc2621 CW |
404 | public static function &import($prefix = FALSE) { |
405 | $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'mapping_field', $prefix, []); | |
60808919 | 406 | return $r; |
e501603b | 407 | } |
c3fc2621 | 408 | |
e501603b TO |
409 | /** |
410 | * Returns the list of fields that can be exported | |
411 | * | |
412 | * @param bool $prefix | |
413 | * | |
414 | * @return array | |
415 | */ | |
c3fc2621 CW |
416 | public static function &export($prefix = FALSE) { |
417 | $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'mapping_field', $prefix, []); | |
60808919 | 418 | return $r; |
e501603b | 419 | } |
c3fc2621 | 420 | |
e7a6b91a AS |
421 | /** |
422 | * Returns the list of indices | |
c3fc2621 CW |
423 | * |
424 | * @param bool $localize | |
425 | * | |
426 | * @return array | |
e7a6b91a AS |
427 | */ |
428 | public static function indices($localize = TRUE) { | |
c3fc2621 | 429 | $indices = []; |
e7a6b91a AS |
430 | return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; |
431 | } | |
c3fc2621 | 432 | |
e501603b | 433 | } |