Story cck has a node reference field -> poll. All polls have been successfully migrated. When Story is being migrated, am getting the following exception:
SQLSTATE[HY000]: General error: 1366 Incorrect integer value: '' for column 'field_poll_target_id' at row 1: INSERT INTO {field_data_field_poll} (entity_type, entity_id, revision_id, bundle, delta, language, field_poll_target_id) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2, :db_insert_placeholder_3, :db_insert_placeholder_4, :db_insert_placeholder_5, :db_insert_placeholder_6); Array ( [:db_insert_placeholder_0] => node [:db_insert_placeholder_1] => 6776 [:db_insert_placeholder_2] => 6779 [:db_insert_placeholder_3] => story [:db_insert_placeholder_4] => 0 [:db_insert_placeholder_5] => und [:db_insert_placeholder_6] => )(/modules/field/modules/field_sql_storage/field_sql_storage.module:448)
The is the field mapping of the poll node:
$this->addFieldMapping('field_poll', 'field_poll_nid')
->sourceMigration(array(''))
->defaultValue(NULL);
Comments
Comment #1
mikeryanTry specifying the sourceMigration as the machine name of the poll migration - not an array, and not an empty string.
Comment #2
mikeryanNo further response.
Comment #3
tmetzger commentedI'm getting this too. I believe it's giving me one failure message for each time the "Story" node doesn't actually point to a "Poll" node (my nodes are actually different types, but the pattern is the same).
I've seen another thread where they suggested that the default value would take care of it, but that hasn't worked so far!
The field isn't required in the D6 source system or in the D7 destination system. Could this be a bug in the handler for node reference fields?
Let me add some detail. In my case "Song" refers to one or more "Composers". Here's my field mapping:
and the error:
So as you can see it's trying to pass in a null value to an integer field...
Tom
Comment #4
peteruithoven commentedI just did a successful migration of a entity reference.
Let's say I had a couple of articles and people could add a reference to another article. I mapped it like this:
$this->addFieldMapping('field_based_on', 'field_derivative')->sourceMigration('article');
"aricle" is the machine name of the same migration.
I'm amazed this is so simple.
Comment #5
tmetzger commentedDid it copy over all your records, or just the ones that had a reference?
Comment #6
tmetzger commentedHey guys,
In case anyone else finds this by searching, here's a tiny patch that fixes the underlying bug in migrate beautifully:
http://drupal.org/node/1805184
Cheers,
Tom
Comment #7
peteruithoven commentedComment #8.0
(not verified) commentedslight edit