src/AppBundle/Controller/Admin/TagGroupController.php

(开头部分) 1KB

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

<?php

namespace AppBundle\Controller\Admin;

use Biz\Taxonomy\Service\TagService;
use Symfony\Component\HttpFoundation\Request;
use AppBundle\Common\ArrayToolkit;

class TagGroupController extends BaseController
{
    public function indexAction(Request $request)
    {
        $tagGroups = $this->getTagService()->findTagGroups();

        return $this->render('admin/tag-group/index.html.twig', array(
            'tagGroups' => $tagGroups,
        ));
    }

    public function createAction(Request $request)
    {
        if ($request->getMethod() == 'POST') {
            $fields = $request->request->all();
            $fields['tagIds'] = $this->getTagIdsFromRequest($request);
            if (isset($fields['tagIds'])) {
                $fields['tagNum'] = count($fields['tagIds']);
            }

            $tagGroup = $this->getTagService()->addTagGroup($fields);

            return $this->render('admin/tag-group/list-tr.html.twig', array(
                'tagGroup' => $tagGroup,
            ));
        }

        return $this->render('admin/tag-group/tag-group-modal.html.twig');
    }

    public function updateAction(Request $request, $groupId)
    {
        if ($request->getMethod() == 'POST') {
            $fields = $request->request->all();
            $fields['tagIds'] = $this->getTagIdsFromRequest($request);
            if (empty($fields['scope'])) {
                $fields['scope'] = array();
            }

            $tagGroup = $this->getTagService()->updateTagGroup($groupId, $fields);

            return $this->render('admin/tag-group/list-tr.html.twig', array(
                'tagGroup' => $tagGroup,
            ));
        }

        $tagGroup = $this->getTagService()->getTagGroup($groupId);
        $tags = $this->getTagService()->findTagsByGroupId($groupId);

        return $this->render('admin/tag-group/tag-group-modal.html.twig', array(
            'tagGroup' => $tagGroup,
            'tags' => ArrayToolkit::column($tags, 'name'),

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

AI 解读 AI

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

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