0

I'm trying to migrate private files (file migration), the problem is even I set file_replace to 'FILE_EXISTS_REUSE' the files are still duplicated (it adds _1 or _2, and so on.). Here is my mapping:

    $this->addFieldMapping('file_replace')
         ->defaultValue('FILE_EXISTS_REUSE');
    $this->addFieldMapping('preserve_files')
       ->defaultValue(FALSE);

Please help!

2
  • Are you sure you should not use $this->addFieldMapping('file_replace')->defaultValue(FILE_EXISTS_REUSE);?
    – avpaderno
    Commented Dec 16, 2015 at 12:13
  • I've already tried that, but still no good.
    – japhfortin
    Commented Dec 16, 2015 at 12:20

2 Answers 2

1

This solved it for me. The documentation at this link has been updated to show that you need to use the class prefix:

$this->addFieldMapping('preserve_files')
  ->defaultValue(1);

$this->addFieldMapping('file_replace')
  ->defaultValue(MigrateFile::FILE_EXISTS_REUSE);
0

Maybe try:

$this->addFieldMapping('field_name', 'field_name');
$this->addFieldMapping('field_name:file_replace')->defaultValue(MigrateFile::FILE_EXISTS_REUSE);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.