src/AppBundle/Controller/Admin/CategoryController.php
(开头部分) 1KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
<?php
namespace AppBundle\Controller\Admin;
use Biz\Taxonomy\CategoryException;
use Symfony\Component\HttpFoundation\Request;
class CategoryController extends BaseController
{
public function embedAction($group, $layout, $menu = null)
{
$group = $this->getCategoryService()->getGroupByCode($group);
if (empty($group)) {
$this->createNewException(CategoryException::NOTFOUND_GROUP());
}
$categories = $this->getCategoryService()->getCategoryStructureTree($group['id']);
return $this->render('admin/category/embed.html.twig', array(
'group' => $group,
'menu' => $menu,
'categories' => $categories,
'layout' => $layout,
));
}
public function createAction(Request $request)
{
if ('POST' == $request->getMethod()) {
$category = $this->getCategoryService()->createCategory($request->request->all());
return $this->renderTbody($category['groupId']);
}
$category = array(
'id' => 0,
'name' => '',
'code' => '',
'description' => '',
'groupId' => (int) $request->query->get('groupId'),
'parentId' => (int) $request->query->get('parentId', 0),
'weight' => 0,
'icon' => '',
);
return $this->render('admin/category/modal.html.twig', array(
'category' => $category,
));
}
public function editAction(Request $request, $id)
{
$category = $this->getCategoryService()->getCategory($id);
if (empty($category)) {
$this->createNewException(CategoryException::NOTFOUND_CATEGORY());
}
if ('POST' == $request->getMethod()) {
$category = $this->getCategoryService()->updateCategory($id, $request->request->all());
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。