public function __construct() { parent::__construct(); $this->description = t('Import users from a CSV file.'); $this->addFieldMapping('name', 'name'); $this->addFieldMapping('pass', 'pass'); $this->addFieldMapping('mail', 'mail'); $this->addFieldMapping('og_user_node', 'account')->sourceMigration('NegawattAccountMigrate')->separator('|'); $this->addFieldMapping('status')->defaultValue(TRUE); // Create a map object for tracking the relationships between source rows $key = array('name' => array('type' => 'varchar', 'length' => 255, 'not null' => TRUE)); $destination_handler = new MigrateDestinationUser(); $this->map = new MigrateSQLMap($this->machineName, $key, $destination_handler->getKeySchema()); // Create a MigrateSource object. $this->source = new MigrateSourceCSV(drupal_get_path('module', 'negawatt_migrate') . '/csv/' . $this->entityType . '/user.csv', $this->csvColumns, array('header_rows' => 1)); $this->destination = new MigrateDestinationUser(); }
public function __construct($arguments) { parent::__construct($arguments); $this->description = t('Import users from a CSV file.'); $this->addFieldMapping('og_user_node', '_company')->separator('|')->sourceMigration('SkeletonCompaniesMigrate'); $this->addFieldMapping('name', '_username'); $this->addFieldMapping('pass', '_password'); $this->addFieldMapping('mail', '_email'); $this->addFieldMapping('roles')->defaultValue(DRUPAL_AUTHENTICATED_RID); $this->addFieldMapping('status')->defaultValue(TRUE); // Create a map object for tracking the relationships between source rows $key = array('_unique_id' => array('type' => 'varchar', 'length' => 255, 'not null' => TRUE)); $destination_handler = new MigrateDestinationUser(); $this->map = new MigrateSQLMap($this->machineName, $key, $destination_handler->getKeySchema()); $query = db_select('_raw_user', 't')->fields('t')->orderBy('__id'); $this->source = new MigrateSourceSQL($query, $this->fields); // Create a MigrateSource object. $this->destination = new MigrateDestinationUser(); }