1

I have a module for my migration. My .info is:

name = "Migrate from MHT"
description = "Module to migrate my old site content to Drupal 7"
package = "ZbLabs"
core = 7.x

dependencies[] = migrate

#  include the files that contain your Migrate classes 
files[] = migrate_mht.migrate.inc
files[] = migrate_mht.module
files[] = migrate_mht_author.inc
files[] = migrate_mht_author_update.inc
files[] = migrate_mht_eventi.inc

In the migrate_mht_author_update.inc I have a class with this code:

$this->map = new MigrateSQLMap($this->machineName,
  array(
    'id' => array(
      'type' => 'int',
      'not null' => TRUE,
      'description' => 'ID utente',
    )
  ),
  MhtAuthorDestination::getKeySchema()
);

The MhtAuthorDestination class is defined in "migrate_mht_author.inc" file.

class MhtAuthorDestinationMigration extends MigrateDestinationUser {

  public function __construct(array $arguments = array()) {
    dd("MhtAuthorDestinationFin __construct");
    dd($arguments);
    parent::__construct();  
  }
  [....]
}

Now when I exec "drush ms" I receive this error:

Error: Class 'MhtAuthorDestination' not found in /MY/PATH/sites/all/modules/zblabs/migrate_mht/migrate_mht_author_update.inc, line 38

In "migrate_mht.migrate.inc" file I have: function migrate_mht_migrate_api() {

 $api = array(
    'api' => 2,
    //'migrations' => array(
      //'MhtAuthorDestination' => array('class_name' => 'MhtAuthorDestination'),
    //),

  );

  return $api;
}

I have tried without comment (//) but the error remain.

Where is my error ?

  • 1
    From what you pasted above, in migrate_mht_author.inc you have defined MhtAuthorDestinationMigration class, not MhtAuthorDestination. So, where is MhtAuthorDestination? – Maciej Zgadzaj May 2 '13 at 12:25
0

The class name in your include file is MhtAuthorDestinationMigration, but you list its class name in hook_migrate_api as MhtAuthorDestination. Uncomment the line and try:

$api = array(
  'api' => 2,
  'migrations' => array(
    'MhtAuthorDestination' => array('class_name' => 'MhtAuthorDestinationMigration'),
  ),
);

return $api;

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