function mongodb_migrate_load_helper in MongoDB 7
Load entity with fields from SQL storage.
Parameters
string $entity_type: The entity type.
array $entities: The entities to load.
string $age: Likely FIELD_LOAD_CURRENT.
array $fields: The fields to load on the entities.
array $options: Load options.
1 call to mongodb_migrate_load_helper()
- mongodb_field_storage_field_storage_load in mongodb_field_storage/
mongodb_field_storage.module - Implements hook_field_storage_load().
File
- mongodb_migrate/
mongodb_migrate.module, line 22 - The mongodb_migrate module provides SQL to MongoDB migration helpers.
Code
function mongodb_migrate_load_helper($entity_type, array $entities, $age, array &$fields, array $options) {
$all_types = variable_get('mongodb_migrate_types', array());
$migrate_fields = variable_get('mongodb_migrate_fields', array());
if (defined('DRUSH_VERSION') && $age == FIELD_LOAD_CURRENT && in_array($entity_type, $all_types)) {
$field_info = field_info_field_by_ids();
$sql_fields = array();
foreach ($fields as $field_id => $ids) {
$field_name = $field_info[$field_id]['field_name'];
if (isset($migrate_fields[$field_name])) {
$sql_fields[$field_id] = $ids;
unset($fields[$field_id]);
}
}
if ($sql_fields) {
field_sql_storage_field_storage_load($entity_type, $entities, $age, $sql_fields, $options);
}
}
}