nid = 0 after book page import
| Project: | Import / Export API |
| Version: | 4.7.x-1.x-dev |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | won't fix |
Jump to:
I'm trying to add import/export support to one of my modules, but ran into problems getting nid updated. So I started playing around with book page, since it uses a similar structure. I created a simple book page and exported it to xml using the predefined definition, but when I imported the node again, it ended up with nid=0 in the book table.
The vid field is updated ok, so I tried to add '#reference_field' => array('revisions', 'nid') to the book_nid definition (similar to the definition of book_vid), since the field isn't named book_nid in the reference entity. But that didn't make any difference.
Changing to definition to
$def['revisions']['book_nid'] = array(
'#type' => 'int',
'#title' => t('Node ID'),
'#reference_entity' => $type,
'#reference_field' => array('nid'), // New
'#reference_delta' => 1, // New
'#reference_parent' => FALSE, // New
'#db_table' => 'book',
'#db_field_unaliased' => 'nid',
'#csv_hidden' => TRUE
);works as long as you are importing the page into the existing node. But if you then make a 'keyless' import (ie. strip away all ids and change all occurences of the title, see attachment) to import as a new node, nid is again 0 in the book table.
This issue might be somewhat related to http://drupal.org/node/93179
| Attachment | Size |
|---|---|
| book_keyless.xml.txt | 1.38 KB |

#1
Version 4.x is now unsupported.