0

I am importing data from another site via a module i am building. The channel I am importing to has a matrix field.

I am doing this like so:

    ee()->load->library('api');
    ee()->api->instantiate('channel_entries');
    ee()->api->instantiate('channel_fields');

    $data = array(
        'title' => 'TEST'
    );
    ee()->api_channel_fields->setup_entry_settings($this->customer_channel_id, $data);
    $success = ee()->api_channel_entries->save_entry($data, $this->customer_channel_id);

    $entry_id = ee()->api_channel_entries->entry_id;

Problem i am having is this error:

A PHP Error was encountered
Severity: Warning
Message: Illegal string offset 'is_draft'
Filename: matrix/ft.matrix.php
Line Number: 2409

A PHP Error was encountered
Severity: Warning
Message: Illegal string offset 'is_draft'
Filename: matrix/ft.matrix.php
Line Number: 2461

Any ideas?

2
  • Could you tell us your EE and Matrix version numbers?
    – jrothafer
    Jun 5, 2015 at 22:29
  • EE 2.9.2 , Matrix 2.6.1
    – BillyMedia
    Jun 5, 2015 at 22:32

1 Answer 1

0

Would it be possible to get you to export the exp_matrix_data? There are a couple of scenarios that I can think could be causing this issue.

  • Check and make sure that there is a a column for 'is_draft'. If you do not see one you need to manually or see the syntax below.
      $this->EE->dbforge->add_column('matrix_data', array(
          'is_draft' => array('type' => 'TINYINT', 'constraint' => '1', 'unsigned' => TRUE, 'default' => 0),          ));
  • If that column is there can you provide both the export and sample file of the data being imported?
1
  • There is a field called is draft as its auto created by the matrix plugin. I think its to do with how the matrix plugin hooks into the entry submission process, that there are hidden vars that get processed, but as i am creating entries via the api, the hidden vars don't exist hence it throwing an error.
    – BillyMedia
    Jun 8, 2015 at 9:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.