BlogCategory::getCategoryList PHP Метод

getCategoryList() публичный Метод

カテゴリリストを取得する
public getCategoryList ( integer $blogContentId, array $options ) : array
$blogContentId integer
$options array
Результат array
    public function getCategoryList($blogContentId, $options)
    {
        $options = array_merge(['depth' => 1, 'type' => null, 'order' => 'BlogCategory.id', 'limit' => false, 'viewCount' => false, 'fields' => ['id', 'name', 'title']], $options);
        $datas = [];
        extract($options);
        if (!$type) {
            $datas = $this->_getCategoryList($blogContentId, null, $viewCount, $depth);
        } elseif ($type == 'year') {
            $options = ['category' => true, 'limit' => $limit, 'viewCount' => $viewCount, 'type' => 'year'];
            $_datas = $this->BlogPost->getPostedDates($blogContentId, $options);
            $datas = [];
            foreach ($_datas as $data) {
                if ($viewCount) {
                    $data['BlogCategory']['count'] = $data['count'];
                }
                $datas[$data['year']][] = ['BlogCategory' => $data['BlogCategory']];
            }
        }
        return $datas;
    }