ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Channel Entries API - missing index 'field_fmt'

January 07, 2011 8:55am

Subscribe [5]
  • #1 / Jan 07, 2011 8:55am

    Chroma Sports

    2 posts

    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: 943

    I’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.

  • #2 / Jan 07, 2011 2:54pm

    Barry Cogan

    291 posts

    HI Chroma,

    Please report these as bugs here.

    Thank you,
    Barry Cogan

  • #3 / Jan 10, 2011 5:32pm

    Chris Chiles

    17 posts

    Chroma,

    I ran into this same issue and filed a bug report here. Looks like it’ll be fixed in the next release.

    - Chris

  • #4 / Jan 10, 2011 5:45pm

    Ingmar

    29245 posts

    Thanks for letting us know. Please don’t hesitate to post again in case there’s anything else.

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases