Commit | Line | Data |
---|---|---|
e501603b | 1 | <?php |
c3fc2621 | 2 | |
e501603b TO |
3 | /** |
4 | * @package CRM | |
6b83d5bd | 5 | * @copyright CiviCRM LLC (c) 2004-2019 |
e501603b TO |
6 | * |
7 | * Generated from xml/schema/CRM/Core/MappingField.xml | |
8 | * DO NOT EDIT. Generated by CRM_Core_CodeGen | |
fb607354 | 9 | * (GenCodeChecksum:e18a4d7c43e3fded3e10bed98437577e) |
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, | |
c3fc2621 | 189 | 'title' => ts('Name'), |
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, | |
c3fc2621 | 218 | 'title' => ts('Column Number'), |
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', |
c3fc2621 CW |
238 | ], |
239 | 'phone_type_id' => [ | |
e501603b TO |
240 | 'name' => 'phone_type_id', |
241 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 242 | 'title' => ts('Phone type ID'), |
215b423e | 243 | 'description' => ts('Which type of phone does this number belongs.'), |
a36434b9 | 244 | 'where' => 'civicrm_mapping_field.phone_type_id', |
522a26c9 | 245 | 'table_name' => 'civicrm_mapping_field', |
246 | 'entity' => 'MappingField', | |
247 | 'bao' => 'CRM_Core_DAO_MappingField', | |
6a7e5e5d | 248 | 'localizable' => 0, |
c3fc2621 CW |
249 | ], |
250 | 'im_provider_id' => [ | |
e501603b TO |
251 | 'name' => 'im_provider_id', |
252 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 253 | 'title' => ts('IM provider ID'), |
215b423e | 254 | 'description' => ts('Which type of IM Provider does this name belong.'), |
a36434b9 | 255 | 'where' => 'civicrm_mapping_field.im_provider_id', |
522a26c9 | 256 | 'table_name' => 'civicrm_mapping_field', |
257 | 'entity' => 'MappingField', | |
258 | 'bao' => 'CRM_Core_DAO_MappingField', | |
6a7e5e5d | 259 | 'localizable' => 0, |
c3fc2621 | 260 | 'html' => [ |
e501603b | 261 | 'type' => 'Select', |
c3fc2621 CW |
262 | ], |
263 | 'pseudoconstant' => [ | |
e501603b TO |
264 | 'optionGroupName' => 'instant_messenger_service', |
265 | 'optionEditPath' => 'civicrm/admin/options/instant_messenger_service', | |
e6ca0a57 | 266 | ], |
c3fc2621 CW |
267 | ], |
268 | 'website_type_id' => [ | |
e501603b TO |
269 | 'name' => 'website_type_id', |
270 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 271 | 'title' => ts('Website type ID'), |
215b423e | 272 | 'description' => ts('Which type of website does this site belong'), |
a36434b9 | 273 | 'where' => 'civicrm_mapping_field.website_type_id', |
522a26c9 | 274 | 'table_name' => 'civicrm_mapping_field', |
275 | 'entity' => 'MappingField', | |
276 | 'bao' => 'CRM_Core_DAO_MappingField', | |
6a7e5e5d | 277 | 'localizable' => 0, |
c3fc2621 | 278 | 'html' => [ |
e501603b | 279 | 'type' => 'Select', |
c3fc2621 CW |
280 | ], |
281 | 'pseudoconstant' => [ | |
e501603b TO |
282 | 'optionGroupName' => 'website_type', |
283 | 'optionEditPath' => 'civicrm/admin/options/website_type', | |
e6ca0a57 | 284 | ], |
c3fc2621 CW |
285 | ], |
286 | 'relationship_type_id' => [ | |
e501603b TO |
287 | 'name' => 'relationship_type_id', |
288 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 289 | 'title' => ts('Relationship type ID'), |
215b423e | 290 | 'description' => ts('Relationship type, if required'), |
a36434b9 | 291 | 'where' => 'civicrm_mapping_field.relationship_type_id', |
522a26c9 | 292 | 'table_name' => 'civicrm_mapping_field', |
293 | 'entity' => 'MappingField', | |
294 | 'bao' => 'CRM_Core_DAO_MappingField', | |
6a7e5e5d | 295 | 'localizable' => 0, |
e501603b | 296 | 'FKClassName' => 'CRM_Contact_DAO_RelationshipType', |
c3fc2621 CW |
297 | ], |
298 | 'relationship_direction' => [ | |
e501603b TO |
299 | 'name' => 'relationship_direction', |
300 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 301 | 'title' => ts('Relationship Direction'), |
e501603b TO |
302 | 'maxlength' => 6, |
303 | 'size' => CRM_Utils_Type::SIX, | |
a36434b9 | 304 | 'where' => 'civicrm_mapping_field.relationship_direction', |
522a26c9 | 305 | 'table_name' => 'civicrm_mapping_field', |
306 | 'entity' => 'MappingField', | |
307 | 'bao' => 'CRM_Core_DAO_MappingField', | |
6a7e5e5d | 308 | 'localizable' => 0, |
c3fc2621 CW |
309 | ], |
310 | 'grouping' => [ | |
e501603b TO |
311 | 'name' => 'grouping', |
312 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 313 | 'title' => ts('Grouping'), |
215b423e | 314 | 'description' => ts('Used to group mapping_field records into related sets (e.g. for criteria sets in search builder |
fb607354 | 315 | mappings).'), |
a36434b9 | 316 | 'where' => 'civicrm_mapping_field.grouping', |
e501603b | 317 | 'default' => '1', |
522a26c9 | 318 | 'table_name' => 'civicrm_mapping_field', |
319 | 'entity' => 'MappingField', | |
320 | 'bao' => 'CRM_Core_DAO_MappingField', | |
6a7e5e5d | 321 | 'localizable' => 0, |
c3fc2621 CW |
322 | ], |
323 | 'operator' => [ | |
e501603b TO |
324 | 'name' => 'operator', |
325 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 326 | 'title' => ts('Operator'), |
215b423e | 327 | 'description' => ts('SQL WHERE operator for search-builder mapping fields (search criteria).'), |
e501603b TO |
328 | 'maxlength' => 16, |
329 | 'size' => CRM_Utils_Type::TWELVE, | |
a36434b9 | 330 | 'where' => 'civicrm_mapping_field.operator', |
522a26c9 | 331 | 'table_name' => 'civicrm_mapping_field', |
332 | 'entity' => 'MappingField', | |
333 | 'bao' => 'CRM_Core_DAO_MappingField', | |
6a7e5e5d | 334 | 'localizable' => 0, |
c3fc2621 | 335 | 'html' => [ |
e501603b | 336 | 'type' => 'Select', |
c3fc2621 CW |
337 | ], |
338 | 'pseudoconstant' => [ | |
e501603b | 339 | 'callback' => 'CRM_Core_SelectValues::getSearchBuilderOperators', |
e6ca0a57 | 340 | ], |
c3fc2621 CW |
341 | ], |
342 | 'value' => [ | |
e501603b TO |
343 | 'name' => 'value', |
344 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 345 | 'title' => ts('Value'), |
215b423e | 346 | 'description' => ts('SQL WHERE value for search-builder mapping fields.'), |
e501603b TO |
347 | 'maxlength' => 255, |
348 | 'size' => CRM_Utils_Type::HUGE, | |
a36434b9 | 349 | 'where' => 'civicrm_mapping_field.value', |
522a26c9 | 350 | 'table_name' => 'civicrm_mapping_field', |
351 | 'entity' => 'MappingField', | |
352 | 'bao' => 'CRM_Core_DAO_MappingField', | |
6a7e5e5d | 353 | 'localizable' => 0, |
c3fc2621 CW |
354 | ], |
355 | ]; | |
346aaaba | 356 | CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); |
e501603b | 357 | } |
346aaaba | 358 | return Civi::$statics[__CLASS__]['fields']; |
e501603b | 359 | } |
c3fc2621 | 360 | |
e501603b | 361 | /** |
bd8e0b14 | 362 | * Return a mapping from field-name to the corresponding key (as used in fields()). |
e501603b TO |
363 | * |
364 | * @return array | |
bd8e0b14 | 365 | * Array(string $name => string $uniqueName). |
e501603b | 366 | */ |
c3fc2621 | 367 | public static function &fieldKeys() { |
bd8e0b14 TO |
368 | if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { |
369 | Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); | |
e501603b | 370 | } |
bd8e0b14 | 371 | return Civi::$statics[__CLASS__]['fieldKeys']; |
e501603b | 372 | } |
c3fc2621 | 373 | |
e501603b TO |
374 | /** |
375 | * Returns the names of this table | |
376 | * | |
377 | * @return string | |
378 | */ | |
c3fc2621 | 379 | public static function getTableName() { |
e501603b TO |
380 | return self::$_tableName; |
381 | } | |
c3fc2621 | 382 | |
e501603b TO |
383 | /** |
384 | * Returns if this table needs to be logged | |
385 | * | |
c3fc2621 | 386 | * @return bool |
e501603b | 387 | */ |
c3fc2621 | 388 | public function getLog() { |
e501603b TO |
389 | return self::$_log; |
390 | } | |
c3fc2621 | 391 | |
e501603b TO |
392 | /** |
393 | * Returns the list of fields that can be imported | |
394 | * | |
395 | * @param bool $prefix | |
396 | * | |
397 | * @return array | |
398 | */ | |
c3fc2621 CW |
399 | public static function &import($prefix = FALSE) { |
400 | $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'mapping_field', $prefix, []); | |
60808919 | 401 | return $r; |
e501603b | 402 | } |
c3fc2621 | 403 | |
e501603b TO |
404 | /** |
405 | * Returns the list of fields that can be exported | |
406 | * | |
407 | * @param bool $prefix | |
408 | * | |
409 | * @return array | |
410 | */ | |
c3fc2621 CW |
411 | public static function &export($prefix = FALSE) { |
412 | $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'mapping_field', $prefix, []); | |
60808919 | 413 | return $r; |
e501603b | 414 | } |
c3fc2621 | 415 | |
e7a6b91a AS |
416 | /** |
417 | * Returns the list of indices | |
c3fc2621 CW |
418 | * |
419 | * @param bool $localize | |
420 | * | |
421 | * @return array | |
e7a6b91a AS |
422 | */ |
423 | public static function indices($localize = TRUE) { | |
c3fc2621 | 424 | $indices = []; |
e7a6b91a AS |
425 | return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; |
426 | } | |
c3fc2621 | 427 | |
e501603b | 428 | } |