Closed (fixed)
Project:
Migrate
Version:
7.x-2.2
Component:
Code
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
23 Nov 2011 at 11:15 UTC
Updated:
14 May 2013 at 17:18 UTC
Full Message:
First parameter must either be an object or the name of an existing class File /home/quickstart/websites/sid.dev/modules/user/user.module, line 552
Processed 1 (0 created, 0 updated, 1 failed, 0 ignored) in 0.1 sec (1074/min) - done with 'SIDstaffContent'
I receive this when trying the import...
my class looks like this:
class SIDstaffContentMigration extends Migration {
public function __construct() {
parent::__construct();
$this->description = t('Migrate SID content from csv file');
$columns[0] = array('id_csv', 'Unique ID');
$columns[1] = array('name', 'name');
$columns[2] = array('mail', 'mail');
$this->source = new MigrateSourceCSV(drupal_get_path('module', 'migrate_sid').'/csv/tbl_staff.csv', $columns);
$this->destination = new MigrateDestinationUser();
$this->map = new MigrateSQLMap($this->machineName,
array(
'id_csv' => array('type' => 'varchar',
'length' => 255,
'not null' => TRUE,
'description' => 'Unique ID',
)
),
MigrateDestinationUser::getKeySchema()
);
//standard fields
$this->addFieldMapping('uid', 'id_csv');
$this->addFieldMapping('name', 'fullname');
$this->addFieldMapping('mail', 'mail');
//all the fields we don’t wanna map in the destination!!!
$this->addFieldMapping('pass')
->issueGroup(t('DNM'));
$this->addFieldMapping('theme')
->issueGroup(t('DNM'));
$this->addFieldMapping('signature')
->issueGroup(t('DNM'));
$this->addFieldMapping('signature_format')
->issueGroup(t('DNM'));
$this->addFieldMapping('created')
->issueGroup(t('DNM'));
$this->addFieldMapping('access')
->issueGroup(t('DNM'));
$this->addFieldMapping('login')
->issueGroup(t('DNM'));
$this->addFieldMapping('status')
->issueGroup(t('DNM'));
$this->addFieldMapping('timezone')
->issueGroup(t('DNM'));
$this->addFieldMapping('language')
->issueGroup(t('DNM'));
$this->addFieldMapping('picture')
->issueGroup(t('DNM'));
$this->addFieldMapping('init')
->issueGroup(t('DNM'));
$this->addFieldMapping('data')
->issueGroup(t('DNM'));
}
Comments
Comment #1
mikeryanWhat's happening is that user_save() is seeing a uid value, and without is_new set to tell it you want to create a new user account with that specific uid value it's assuming that it's supposed to update an existing account with that uid. But, there is none.
If you want to preserve the old ID as the Drupal uid, you need to add
If that's not what you're trying to do, do not map anything to 'uid'.
Comment #3
tinflute commentedThis helped me!
Comment #4
mccrodp commentedI added user.inc from the migrate_d2d module to my custom migrate module folder and info file and added the following override
This does not import users and gives the migration error messages below
Everything looks fine at admin/content/migrate/User with uid field in source mapped to uid field in destination. Am I misunderstanding something from your above explanation?
The 'is_new' field mapping is also causing this warning
Thanks,
Paul.
Comment #5
mccrodp commentedComment #6
mikeryanPlease don't reopen long-closed issues.
I would guess that you added your 'is_new' mapping before the pre-existing do-not-migrate mapping for it, so the latter mapping overrode yours. Remove the other 'is_new' mapping and you should be set.
Comment #7
mccrodp commentedExcellent, thanks a lot, actually never knew about the reopening long-closed issues either, sorry and thanks for the info.
I removed 'is_new' from the following array
$this->addUnmigratedDestinations(array('is_new', 'role_names'));to$this->addUnmigratedDestinations(array('role_names'));and it worked as you advised.