Hey guys,
If you’re writing a custom data importer that uses relationships, there is a ‘gotcha’ in the api_channel_entries and submitting a new entry multiple times. The relationship data gets all messed up.
The culprit is that the method _build_relationships($data) checks if there already is an $entry_id as a class member.
Once you have called submit_new_entry(), make sure to clear the entry_id:
i.e.:
if ($this->EE->api_channel_entries->submit_new_entry(4, $data) === FALSE){
return false;
}
$entry_id = $this->EE->api_channel_entries->entry_id; //get the entry id for whatever you want
$this->EE->api_channel_entries->entry_id = NULL; //FORCE CLEAR THE entry_idPacket Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.