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.

Possible bug in the channel categories api

December 29, 2011 9:56pm

Subscribe [2]
  • #1 / Dec 29, 2011 9:56pm

    In the Channel Categories API documentation it says to expect an array count of seven, [0-6].

    http://ellislab.com/expressionengine/user-guide/development/api/api_channel_categories.html

    Notice in the screenshot the returned category_tree() array contains a count of 6, [0-5], missing the (int) Category Parent ID index.

    My code to generate this error is simple:

    $this->EE->load->library('api');
    $this->EE->api->instantiate('channel_categories');
      
    $category_tree = $this->EE->api_channel_categories->category_tree($cat_group->row('group_id'));
      
    var_dump($category_tree);exit();

    Before submitting a bug report, I wanted to confirm it was a bug. As it stands, the entire method isn’t usable unless I have hook into the parent. Anyway around this issues? I looked at the code at directly in the Api_channel_categories.php file and doesn’t seem like a bug exactly, more like it’s just not suppose to be there.

    $this->categories[$key] = array($key, $val['1'], $val['2'], $val['3'], $sel, $depth);
    
    //$this->categories[$key] = array('cat_id' => $key, 'cat_name' => $val['1'], 'group_id' => $val['2'], 'group_name' => $val['3'], 'selected' => $sel, 'depth' => $depth);     
        
    $this->_category_subtree($key, $cat_array, $depth, $selected);
  • #2 / Dec 30, 2011 2:40pm

    Dan Decker

    7338 posts

    Hi SaucePan Creative,

    Can you supply the version of ExpressionEngine that you are experiencing this with? I need that info to be able to replicate this.

    Thanks!

  • #3 / Dec 30, 2011 3:35pm

    v2.2.2, I guess I should have tried to upgrade first to see if that fixed the problem, but that would mean more strict minimum requirements for users buying the add-on.

  • #4 / Jan 02, 2012 12:46pm

    Dan Decker

    7338 posts

    I understand wanting to get your add-on to the broadest market possible. Can you set up a 2.3.1 sandbox and see if the problem still exits? I don’t have 2.2.2 running anywhere. There are a couple of things to keep in mind here, we don’t provide support for add-on development, but I’ll run this up to the Devs to see if they have some insight. I could also move this over to the Development and Programming forum to get the Community in on the discussion. It’s likely others have run into this issue and have a solution handy.

    Cheers!

  • #5 / Jan 03, 2012 3:03pm

    Robin Sowell

    13255 posts

    Dan bumped me on this so I took a quick look- it appears this was fixed by 2.3.0:

    $this->categories[$key] = array($key, $val['1'], (int) $val['2'], $val['3'], $sel, $depth, (int) $val[0]);

    In this particular case?  I wouldn’t worry about backwards compatibility beyond there, particularly for a new add-on.  And going forward, you should be good to go.

  • #6 / Jan 05, 2012 5:00am

    John Henry Donovan

    12339 posts

    Thanks Robin. Can you go ahead and perform an upgrade please SaucePan Creative and confirm that the fix indeed works for you?

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

ExpressionEngine News!

#eecms, #events, #releases