fetchAssoc()) { $mapping = unserialize($row['mapping']); $entity_type = $row['type']; $bundle = $row['bundle']; // Create a config object for the mapping. $config = config("rdf.mapping.$entity_type.$bundle") ->set('id', "$entity_type.$bundle") ->set('uuid', $uuid->generate()) ->set('targetEntityType', $entity_type) ->set('bundle', $bundle); // Add the bundle and field mappings. $field_mappings = array(); foreach ($mapping as $key => $value) { // If this is the rdftype entry, add the types to the config object. if ($key == 'rdftype') { $config->set('types', $value); } // Otherwise, this key is a field. Process the field mapping into the new // structure. else { // Since reverse relations are not supported in D8, drop any mappings // which use the 'rev' type. if (!empty($value['type'])) { if ($value['type'] == 'rev') { continue; } $field_mappings[$key]['mapping_type'] = $value['type']; } !empty($value['predicates']) ? $field_mappings[$key]['properties'] = $value['predicates'] : NULL; !empty($value['datatype']) ? $field_mappings[$key]['datatype'] = $value['datatype'] : NULL; !empty($value['callback']) ? $field_mappings[$key]['datatype_callback'] = $value['callback'] : NULL; } } $config->set('fieldMappings', $field_mappings); // Save the mapping config object. $config->save(); } }