Skip to main content
removed email address
Source Link
2pha
  • 2.3k
  • 1
  • 14
  • 19

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 Brown''Chris', 'chris@2pha'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 :)

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 Brown', 'chris@2pha.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 :)

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 :)

Source Link
2pha
  • 2.3k
  • 1
  • 14
  • 19

Migrate error: Call to a member function count() on a non-object

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 Brown', '[email protected]',
          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 :)