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