I'm trying to create a category through the api to import a load of datas, but I'm stuck, the category won't be saved, and the saveCategory() method just returns false
$category = new CategoryModel();
$category->setContentFromPost(array(
'groupId' => $this->category_group_id,
'title' => $data[0],
'colorCode' => $data[1],
'colorPreview' => $data[2]
));
$category->enabled = true;
$res = craft()->categories->saveCategory($category);
Can I get a glimpse of what's happening, or the error ?
Is there anything wrong in this code ? Does anyone have a good example/documentation for this ?
Thanks for your help.
Nicolas