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.

Relationships lose all data when updating entry from api

November 12, 2013 4:48pm

Subscribe [2]
  • #1 / Nov 12, 2013 4:48pm

    jhsnowboard

    3 posts

    So when i’m updating channel entries via the API, I keep losing all relationship data.
    How can I keep the data?

    //$data has array with some new data. never relationship data though
    
    $cd = $this->EE->db->get_where('channel_data', array('field_id_2' => $id));
    $cd_res_arr = $cd->result_array();
    
    $entry_id = $cd_res_arr[0]['entry_id'];
    $new_entry_data = $cd_res_arr[0];
    
    //MAKE SURE NO OVERWRITING WITH BLANK DATA
    foreach($data as $data_field_name => $data_field_value) {
     $new_entry_data[$data_field_name] = $data_field_value;
    }
       
    $update_success = $this->EE->api_channel_entries->update_entry($entry_id, $new_entry_data);


    What extra step do i need to keep relationship data from deleting?
    thanks!

  • #2 / Nov 21, 2013 11:48am

    msunickb

    19 posts

    I see the bug report for this at https://support.ellislab.com/bugs/detail/19817 but does anyone have any additional information or a workaround? We are having the same issue. We cannot create relationships using the save_entry api function.

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

ExpressionEngine News!

#eecms, #events, #releases