I am migrating files (images) to Drupal 8 from external service and I need to update quite often some of them. Specifically, I need to update image content and the changed date. Problem is that current implementation of EnityFile in migrate destination plugin, is not allowing to update file entity. Yes you can update image content (and its properties like filemime, filesize), when you are using file_copy, since it is updating those stuff. Example of yaml:
uri:
plugin: file_copy
source:
- source_uri
- destination_uri
But you cannot update the change date, because of this code:
\Drupal\file\Plugin\migrate\destination\entity:34
$entity = $this->storage->loadByProperties(['uri' => $destination]);
if ($entity) {
return reset($entity);
}
else {
return parent::getEntity($row, $old_destination_id_values);
}
If entity exists, it is only loaded, but there is no update operation.