public function EntityListMigrateSource::fetchItem in CRM Core 7
Fetch item from CiviCRM.
1 call to EntityListMigrateSource::fetchItem()
- EntityListMigrateSource::getNextRow in modules/
crm_core_data_import/ plugins/ source/ CivicrmDataSourceHandler.inc
File
- modules/
crm_core_data_import/ plugins/ source/ CivicrmDataSourceHandler.inc, line 657
Class
- EntityListMigrateSource
- Class EntityListMigrateSource which contains list of entities.
Code
public function fetchItem() {
$options = array();
$this
->attachBundleCriteria($options);
$this
->attachIdCriteria($options);
if ($this->entityType == 'Contact') {
foreach (_crm_core_data_import_contact_field_collection_fields() as $collection_item) {
$options['api.' . $collection_item . '.get'] = 1;
}
}
$custom_fields_options = $this
->attachCustomFields($options, $this->entityType);
$core_fields = crm_core_data_import_civicrm_api($this->entityType, 'get', $options);
$custom_fields = crm_core_data_import_civicrm_api($this->entityType, 'get', $custom_fields_options);
// Need to check for empty data just in case to avoid exceptions.
$current_id = $this->entityList[$this->currentId];
$core_fields = !empty($core_fields[$current_id]) ? $core_fields[$current_id] : array();
$custom_fields = !empty($custom_fields[$current_id]) ? $custom_fields[$current_id] : array();
$item = array_merge($core_fields, $custom_fields);
return $this
->processObjectProperties($item);
}