public function ReferencesCiviCrmImportSettings::postImport in CRM Core 7
Performs when import was successful.
Overrides CRMCoreDataImportSettings::postImport
File
- modules/
crm_core_data_import/ plugins/ settings/ ReferencesCiviCrmImportSettings.inc, line 39
Class
Code
public function postImport($importer, $imported_item) {
$settings = $importer
->getSettings();
if (!empty($settings['references']['enable']) && !empty($settings['references']['fields']) && is_a($importer->source_plugin, 'CivicrmDataSourceHandler')) {
$list = $importer->source_plugin
->getEntitiesForReferences($settings['references'], $imported_item, $importer);
if (!empty($list)) {
$source_entity = entity_load_single($imported_item['entity_type'], $imported_item['entity_id']);
$changed = FALSE;
foreach ($list as $item) {
$this
->attachReference($source_entity, $imported_item['entity_type'], $item['destination_entity'], $item['plugin_data'], $changed);
}
if ($changed) {
entity_save($imported_item['entity_type'], $source_entity);
}
}
}
}