Migration of node reference and terms in d6 to d8 using function hook_migrate_prepare_row
Here is how we have implemented. In our case we migration from d6 ‘story’ content type to d8 ‘common_content’ type.
Here field_author_name: field_author_name is the node reference field.
In d8 there is no node reference field instead of that there entity reference.
Now we have to look into the .module file to implement function hook_migrate_prepare_row
$row Stores a row from the source .There we have used Row::getSourceProperty which retrieve the source property. Once we get the value we have to set the source property also using Row::setSourceProperty . We had set the source property as per D8 node structure.
$value[$key]['target_id'] = $val['nid'];
$value[$key]['target_type'] = 'node';