/** * Adds category to the list of this news item categories. * * @param kyNewsCategory $category News category. * @param bool $clear Clear the list before adding. * @return kyNewsItem */ public function addCategory(kyNewsCategory $category, $clear = false) { if ($clear) { $this->categories = array(); $this->category_ids = array(); } if (!in_array($category->getId(), $this->category_ids)) { $this->category_ids[] = $category->getId(); $this->categories[$category->getId()] = $category; } return $this; }
/** * Creates a news category. * WARNING: Data is not sent to Kayako unless you explicitly call create() on this method's result. * * @see kyNewsCategory::VISIBILITY_TYPE constants. * * @param string $title Title of news category. * @param int $visibility_type Visibility type of news item. * @return kyNewsCategory */ public static function createNew($title, $visibility_type) { $new_news_category = new kyNewsCategory(); $new_news_category->setTitle($title); $new_news_category->setVisibilityType($visibility_type); return $new_news_category; }