Hi,
I’m working on importing data (mentioned it in another thread, but posted as tracerstar), and I’m getting some PHP errors.
Using this bit of code ($entry is an array of data I am inserting):
$channel_id = 1;
$entry_data = array(
'title' => $entry['headline'],
'entry_id' => 0,
'entry_date' => strtotime($entry['dateTime']),
'field_id_1' => $entry['content'],
'field_ft_1' => 'xhtml',
'field_id_2' => $entry['teaser'],
'field_ft_2' => 'none',
'field_id_3' => $entry['img_field'],
'field_ft_3' => $entry['img_field_ft']
);
$this->EE->api_channel_entries->submit_new_entry($channel_id, $entry_data);I’m getting the error:
A PHP Error was encountered
Severity: Notice
Message: Undefined index: field_fmt
Filename: api/Api_channel_entries.php
Line Number: 943I’ve traced it back through the API to be in the library file Api_channel_fields.php The function which creates the settings for the custom fields is not selecting the field “field_fmt” from the database, but this field is trying to be read in the method “_base_prep” on line 943 of the Api_channel_entries.php library file.
I’ve fixed this by adding to the Api_channel_fields.php the necessary code to select and set this field, but I just wanted check if this is a bug or not?
Interestingly, this bit of code in the Api_channel_entries.php file (lines 939 - 941) seem to suggest that a data field named “field_ft_field_id_X” is required (where X is an int of the field ID).
$id = 'field_id_'.$id;
if ($data['entry_id'] == 0 && ! isset($data['field_ft_'.$id]))Is this another bug, or am I missing something?
Thanks,
Ben.