I'm trying to migrate a vBulletin forum into D7, but while migrating the hierarchy of the forum containers (parentid) produces the following error on some of the rows:
SQLSTATE[22003]: Numeric value out of range: 1264 Out of range value adjusted for column 'parent' at row 1: INSERT INTO {taxonomy_term_hierarchy} (tid, parent) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1); Array ( [:db_insert_placeholder_0] => 74 [:db_insert_placeholder_1] => -1 ) (/home/ctsproj/public_html/modules/taxonomy/taxonomy.module:645)
parentid of -1 (vBulletin's default for forum containers) can't migrate into Drupal's parent column
Is there a way that can I massage the data to ensure all parentid's of -1 become 0 ?
I guess it's similar to the migrate_wine/wine.inc prepare function, but I can't quite work it out
public function prepare(stdClass $account, stdClass $row) {
// Gender data comes in as M/F, needs to be saved as Male=0/Female=1
// TIP: Note that the Migration prepare method is called after all other
// prepare handlers. Most notably, the field handlers have had their way
// and created field arrays, so we have to save in the same format.
switch ($row->sex) {
case 'm':
case 'M':
$account->field_migrate_example_gender[LANGUAGE_NONE][0]['value'] = 0;
break;
case 'f':
case 'F':
$account->field_migrate_example_gender[LANGUAGE_NONE][0]['value'] = 1;
break;
default:
$account->field_migrate_example_gender = NULL;
break;
}
Thanks
Stuart
Comments
Comment #1
StuartDH commentedI think I've managed to sort it by adding a public function prepare.
Is this the best way to do it or would something like a prepareRow do it better?
Comment #2
mikeryanprepareRow() would also work, or a callback:
Comment #4
bailey86 commentedThis looks like it could be related to a bug in the Debian package libapache2-mod-php5filter. I've reported it here:
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=709023
My fix was to install the package libapache2-mod-php5 which then replaced libapache2-mod-php5filter.
In fact the package libapache2-mod-php5 should be used in preference to libapache2-mod-php5filter as on the package page for libapache2-mod-php5filter it even says 'Unless you specifically need filter-module support, you most likely should instead install libapache2-mod-php5.'
This has also been reported as a bug - http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=709027
It could also be related to https://bugs.php.net/bug.php?id=62507
Comment #5
mohit_aghera commentedSome time if source table contains bigger ID then migrate class shows this error.
By making this as float variable or variable that suites source id will resolve this issue.
For ex: I had source id 1178620778846 and was giving errors for interger type.
So previously it was like
After i changed as given below and it worked
I have added 'size' => 'big' in mapping array.