Пример #1
0
 /**
  * Returns categories of this news item.
  * Result is cached until the end of script.
  *
  * @param bool $reload True to reload data from server. False to use the cached value (if present).
  * @return kyResultSet
  */
 public function getCategories($reload = false)
 {
     foreach ($this->category_ids as $category_id) {
         if (!is_array($this->categories) || !array_key_exists($category_id, $this->categories) || $reload) {
             $this->categories[$category_id] = kyNewsCategory::get($category_id);
         }
     }
     foreach ($this->categories as $category_id => $category) {
         if (!in_array($category_id, $this->category_ids)) {
             unset($this->categories[$category_id]);
         }
     }
     return new kyResultSet(array_values($this->categories));
 }