0

I am trying to implement a user migration with the migration module but am getting this error:

Fatal error: Call to a member function count() on a non-object in E:\wamp\www\website\sites\all\modules\migrate\includes\migration.inc on line 946

here is my migrate class:

abstract class CakeBaseMigration extends Migration {
  public function __construct($arguments) {
    parent::__construct($arguments);

    $this->team = array(
      new MigrateTeamMember('Chris', 'chris@somewhere.com',
          t('developer')),
    );

    Database::addConnectionInfo('for_migration', 'default', array(
      'driver' => 'mysql',
      'database' => 'databasename',
      'username' => 'username',
      'password' => 'password',
      'host' => 'localhost',
      'prefix' => '',
    ));

  }
}

class CakeUserMigration extends CakeBaseMigration {
  public function __construct($arguments) {

    parent::__construct($arguments);
    $this->description = t('Lagacy cakePHP system customers');


    $query = Database::getConnection('default', 'for_migration')
    ->select('customers', 'c')
    ->fields('c');

    $this->source = new MigrateSourceSQL($query);
    $this->destination = new MigrateDestinationUser();

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

    $this->addFieldMapping('username', 'name');
    $this->addFieldMapping('pass', 'password');
    $this->addFieldMapping('mail', 'email');
    $this->addFieldMapping('created', 'modified');
    $this->addFieldMapping('roles')
    ->separator(',')
    ->defaultValue(DRUPAL_AUTHENTICATED_RID.',4');

  }
}

running the drush command drush migrate-audit --allsays that that cakeUser is missing a source and destination.

I don't get it, Setting the database and running the query at devel/php returns the expected rows from the database.

Any help on this would be fantastic :)

0

It seems the problem was the files not saving properly after I updated them, The code I posed above seems to be working ok now.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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