Happy New Year everyone,

I am fairly new to the Migrate Module and have come to a halt concerning image migration. To begin with, my problem currently is that when I run my migration, drush outputs: "New object was not saved, no error provided".

Now all I want is to get the images relating to a specific content type (educational_activity) and copy them over to my destination folder.


class EduActFile extends EduMigration {

public function __construct() {


#Define variable for the default user id (user="grammateia") wherever it is used (uid, revision_uid, etc.). 

// Describe the class for the Migrate UI

$this->description = t('Migrate files');

$query = Database::getConnection('default', 'migrationDB')
           ->select('node', 'n');
//$query->leftJoin('content_field_filename', 'fi', 'n.nid = fi.nid');
$query->leftJoin('content_field_images', 'fim', 'n.nid = fim.nid');
//$query->leftJoin('files', 'fil', 'fil.fid = fi.field_filename_fid');
$query->leftJoin('files', 'file', 'file.fid = fim.field_images_fid');
      //->fields('fil', array('fid', 'filename', 'filepath', 'filemime', 'filesize', 'timestamp'))
      ->fields('file', array('fid', 'filename', 'filepath', 'filemime', 'filesize', 'timestamp'))
      ->condition('type', "educational_activity",'=')

$this->source = new MigrateSourceSQL($query, array(), NULL, array('map_joinable' => FALSE));

// Specify that we want to create files from the source data

$this->destination = new MigrateDestinationFile('');

// Remember what source record created each destination object and track migration status and allow rollback with MigrateSQLMap class

$this->map = new MigrateSQLMap($this->machineName,
      'nid' => array('type' => 'int',
                       'not null' => TRUE,
                       'description' => 'Node ID',
                       'alias' => 'n'

$this->addUnmigratedSources(array ('fid','filepath', 'filemime', 'filesize', 'timestamp'), t('Source fields that we will not be migrating'));

$this->addUnmigratedDestinations (array('timestamp', 'destination_file'));


// For each source row to be processed define data mappings to the destination field from source field

$this->addFieldMapping('value', 'filename');

// Specify the location of the source folder to find the files


// Specify the location of the destination folder to place the files


// Use existing files


// Ensure files are not deleted during rollback


}//construct ends


Do I need to use a different class to migrate files? Is my query wrong? Thanks in advance, your help will be greatly appreciated.

  • Is there anything helpful in watchdog? Jan 4, 2013 at 6:34
  • Unfortunately not, the watchdog logs regarding this migration only contain the generic error "New object was not saved, no error provided". I figured though that the image files that are assigned to the node instances I am checking have an fid value of "NULL" in the "content_field_images" table. I am guessing that is the culprit.
    – Jim Bidis
    Jan 4, 2013 at 11:34
  • How about going to admin/content/migrate and seeing if the "messages" column has a link for that migration? I had the exact same problem yesterday and the messages page for that migration had more details about what was wrong (permissions issue in my case). Jan 4, 2013 at 15:21
  • I will investigate the permissions issue as soon as I have time thank you for the tip.
    – Jim Bidis
    Jan 7, 2013 at 9:23

1 Answer 1


This has been answered by me in another question I made. It can be found here: Migrating Multiple Files in a Node

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.