CRM_Import_ImportProcessor
class CRM_Import_ImportProcessor
Class CRM_Import_ImportProcessor.
Import processor class. This is intended to provide a sanitising wrapper around the form-oriented import classes. In particular it is intended to provide a clear translation between the saved mapping field format and the quick form & parser formats.
In the first instance this is only being used in unit tests but the intent is to migrate to it on a trajectory similar to the ExportProcessor so it is not in the tests.
Properties
protected array | $mappingFields | An array of fields in the format used in the table civicrm_mapping_field. | |
protected array | $metadata | ||
protected array | $metadataByTitle | Metadata keyed by field title. | |
protected string | $contactType | Get contact type being imported. | |
protected string | $contactSubType | Get contact sub type being imported. | |
protected array | $validRelationships | Array of valid relationships for the contact type & subtype. | |
protected string | $formName | Name of the form. | |
protected int | $mappingID | Saved Mapping ID. |
Methods
No description
No description
No description
No description
Get contact subtype for import.
Set contact subtype for import.
No description
Setting for metadata.
No description
No description
Get the contact type for the import.
No description
Set the contact type according to the constant.
Get Mapping Fields.
Set mapping fields.
Get the names of the mapped fields.
Get the field name for the given column.
Get the field name for the given column.
Get relationship key only if it is valid.
Get the IM Provider ID.
Get the Phone Type
Get the Website Type
Get the Location Type
Get the IM or Phone type.
Get the location types of the mapped fields.
Get the phone types of the mapped fields.
Get the names of the im_provider fields.
Get the names of the website fields.
Get an instance of the importer object.
Load the mapping from the datbase into the format that would be received from the UI.
Get the titles from metadata.
Rekey the array by the column_number.
Get the field name from the label.
Validate the key against the relationships available for the contatct type & subtype.
Get the relevant js for quickform.
Get the defaults for the column from the saved mapping.
Details
at line 67
string
getFormName()
at line 74
setFormName(string $formName)
at line 81
array
getValidRelationships()
at line 97
setValidRelationships(array $validRelationships)
at line 106
string
getContactSubType()
Get contact subtype for import.
at line 115
setContactSubType(string $contactSubType)
Set contact subtype for import.
at line 129
array
getMetadata()
at line 143
setMetadata(array $metadata)
Setting for metadata.
We wrangle the label for custom fields to include the label since the metadata trait presents it in a more 'pure' form but the label is appended for importing.
at line 161
int
getMappingID()
at line 168
setMappingID(int $mappingID)
at line 177
string
getContactType()
Get the contact type for the import.
at line 184
setContactType(string $contactType)
at line 193
setContactTypeByConstant(int $contactTypeKey)
Set the contact type according to the constant.
at line 209
array
getMappingFields()
Get Mapping Fields.
at line 227
setMappingFields(array $mappingFields)
Set mapping fields.
We do a little cleanup here too.
We ensure that column numbers are set and that the fields are ordered by them.
This would mean the fields could be loaded unsorted.
at line 246
getFieldNames()
Get the names of the mapped fields.
at line 258
string
getFieldName(int $columnNumber)
Get the field name for the given column.
at line 270
string
getRelationshipKey(int $columnNumber)
Get the field name for the given column.
at line 284
string|null
getValidRelationshipKey(int $columnNumber)
Get relationship key only if it is valid.
at line 298
int
getIMProviderID(int $columnNumber)
Get the IM Provider ID.
at line 311
int
getPhoneTypeID(int $columnNumber)
Get the Phone Type
at line 324
int
getWebsiteTypeID(int $columnNumber)
Get the Website Type
at line 339
int
getLocationTypeID(int $columnNumber)
Get the Location Type
Returning 0 rather than null is historical.
at line 354
int
getPhoneOrIMTypeID(int $columnNumber)
Get the IM or Phone type.
We have a field that would be the 'relevant' type - which could be either.
at line 363
getFieldLocationTypes()
Get the location types of the mapped fields.
at line 372
getFieldPhoneTypes()
Get the phone types of the mapped fields.
at line 381
getFieldIMProviderTypes()
Get the names of the im_provider fields.
at line 390
getFieldWebsiteTypes()
Get the names of the website fields.
at line 401
CRM_Contact_Import_Parser_Contact
getImporterObject()
Get an instance of the importer object.
at line 428
protected
loadSavedMapping()
Load the mapping from the datbase into the format that would be received from the UI.
at line 462
getMetadataTitles()
Get the titles from metadata.
at line 476
protected array
rekeyBySortedColumnNumbers(array $mappingFields)
Rekey the array by the column_number.
at line 489
protected string
getNameFromLabel(string $label)
Get the field name from the label.
at line 501
protected bool
isValidRelationshipKey(string $key)
Validate the key against the relationships available for the contatct type & subtype.
at line 513
string
getQuickFormJSForField(int $column)
Get the relevant js for quickform.
at line 554
array
getSavedQuickformDefaultsForColumn(int $column)
Get the defaults for the column from the saved mapping.