Bug #23422 See Comments

re: 23358 - saving entries with channel form causes error

Version: 4.0.5 Reporter: matrix10

related to previous bug marked as fixed (#23358) - started another ticket as I’m now using a newer version. – not sure if this is what I should have done?

I’ve corrected the error by editing Model/Channel/ChannelEntry.php just checked for empty categories.. (I think??).

Seems fine now but it will break again when I next update.

line 751 in v4.0.5:

// Set the data on the fields in case we come back from a validation error
foreach ($cat_groups as $cat_group)
{
    $group_cats = $categories['cat_group_id_'.$cat_group];

    if(!empty($group_cats)){
     $category_ids = array_merge($category_ids, $group_cats);

     $this->setRawProperty('cat_group_id_'.$cat_group, implode('|', $group_cats));
     $this->getCustomField('categories[cat_group_id_'.$cat_group.']')->setData(implode('|', $group_cats));
    }
}

$cat_objects = $this->getModelFacade()
    ->get('Category')
    ->filter('site_id', ee()->config->item('site_id'));

if(!empty($category_ids)){
    $cat_objects = $cat_objects->filter('cat_id', 'IN', $category_ids);
}

$cat_objects = $cat_objects->all();
.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases