public function UserContactImportSettings::createContactRelation in CRM Core 7
Create relation between user and crm core contact.
Parameters
user $source_entity: Source entity.
crm_core_contact $destination_entity: Target entity.
1 call to UserContactImportSettings::createContactRelation()
- UserContactImportSettings::postImport in modules/
crm_core_data_import/ plugins/ settings/ UserContactImportSettings.inc - Performs when import was successful.
File
- modules/
crm_core_data_import/ plugins/ settings/ UserContactImportSettings.inc, line 240
Class
Code
public function createContactRelation($source_entity, $destination_entity) {
if ($source_entity && $destination_entity) {
$endpoints = array(
array(
'entity_type' => 'user',
'entity_bundle' => 'user',
'entity_id' => $source_entity->uid,
),
array(
'entity_type' => 'crm_core_contact',
'entity_bundle' => $destination_entity->type,
'entity_id' => $destination_entity->contact_id,
),
);
$relation = relation_create('crm_core_user_sync', $endpoints);
relation_save($relation);
}
}