Bug #23073 See Comments

Api_channel_entries requires you to load “stats” library

Version: 3.3.0 Reporter: lkdennis

This is an archived bug report. If you are experiencing a similar issue, upgrade to the latest release and if that does not solve the problem, submit a new bug report

Maybe I’m using this wrong, but I went from the example given.

.

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

     $data = array();
     $data['title'] = ee()->input->post('post_title');
     //$data['entry_date'] = ee()->input->post('date');
     $data['field_id_2'] = ee()->input->post('job_title');
    $data['field_ft_2'] = 'none';

    ee()->api_channel_fields->setup_entry_settings(2, $data);

    $success = ee()->api_channel_entries->save_entry($data, 2);
    if ( ! $success)
    {
      $this->response(show_error(implode('
', $this->api_channel_entries->errors)));
    }

This kept giving me a html response with the error “Exception Caught: No such property: ‘stats’ on EllisLab\ExpressionEngine\Legacy\Facade”.

So I found someone else had to add the ‘stats’ library to get it to work.

ee()->load->library('stats');

Is this something specific to the way I’m using this in my extension or should it be added to the documentation?

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

ExpressionEngine News!

#eecms, #events, #releases