src/AppBundle/Util/CategoryBuilder.php

(开头部分) 886B

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

<?php

namespace AppBundle\Util;

use Topxia\Service\Common\ServiceKernel;

class CategoryBuilder
{
    public function buildChoices($groupCode, $indent = ' ')
    {
        $group = $this->getCategoryService()->getGroupByCode($groupCode);
        if (empty($group)) {
            return array();
        }

        $choices = array();
        $categories = $this->getCategoryService()->getCategoryTree($group['id']);

        foreach ($categories as $category) {
            $choices[$category['id']] = str_repeat(is_null($indent) ? '' : $indent, ($category['depth'] - 1)).$category['name'];
        }

        return $choices;
    }

    private function getCategoryService()
    {
        return self::getServiceKernel()->getBiz()->service('Taxonomy:CategoryService');
    }

    protected static function getServiceKernel()
    {
        return ServiceKernel::instance();
    }
}

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。