nid = 0 after book page import

rolandr - December 17, 2006 - 21:13
Project:Import / Export API
Version:4.7.x-1.x-dev
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:won't fix
Description

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

AttachmentSize
book_keyless.xml.txt1.38 KB

#1

earnie - October 12, 2009 - 14:35
Status:active» won't fix

Version 4.x is now unsupported.

 
 

Drupal is a registered trademark of Dries Buytaert.