I have a migration with an image field and the files already exist on the server where I want them.
There is a file, some_file.jpg that already exists at sites/default/files/some_file.jpg but when I run the migration, it tries to copy the file from sites/default/files/some_file.jpg to sites/default/files/node_type/some_file.jpg and then also creates another file entity for it. I just want it to re-use the file and file entity that already exist for it. The destination field type is an image field.
I have this on the field mapping for the file field:
$this->addFieldMapping('field_upload_image', 'field_res_upload_photo'); $this->addFieldMapping('field_upload_image:preserve_files') ->defaultValue(TRUE); $this->addFieldMapping('field_upload_image:file_replace') ->defaultValue(MigrateFile::FILE_EXISTS_REUSE);