redcode/tree-bundle

此Symfony扩展将jsTree和Gedmo Nested Set直接集成到Sonata Admin中

安装量: 47,912

依赖项: 0

建议者: 0

安全: 0

星星: 30

关注者: 6

分支: 19

语言:HTML

类型:symfony-bundle

0.1-alpha 2016-07-27 07:21 UTC

This package is not auto-updated.

Last update: 2024-09-17 03:32:36 UTC


README

此扩展将jsTreeGedmo Nested Set直接集成到Sonata Admin

树以异步方式构建。因此,它非常适合大型树。

安装

安装需求

SonataAdminBundle
- SonataAdminBundle在此处提供了安装文章
https://symfony.com.cn/doc/current/bundles/SonataAdminBundle/index.html

StofDoctrineExtensionsBundle
- 然后您需要安装StofDoctrineExtensionsBundle
https://symfony.com.cn/doc/master/bundles/StofDoctrineExtensionsBundle/index.html

启用树扩展
- 嵌套行为将在您的实体上实现标准的Nested-Set行为
https://github.com/Atlantic18/DoctrineExtensions/blob/master/doc/tree.md

安装TreeBundle

通过composer安装

composer require redcode/tree-bundle

在您的app kernel ./app/AppKernel.php中注册此bundle

class AppKernel extends Kernel
{
    public function registerBundles()
    {
        $bundles = array(
            ...
            new RedCode\TreeBundle\RedCodeTreeBundle(),
        );
        ...
    }
}

将以下行添加到路由文件./app/config/routing.yml

redcode_tree:
    resource: "@RedCodeTreeBundle/Resources/config/routing.yml"
    prefix:   /admin

对于启用了Gedmo Nested Set的实体,请按照以下步骤操作

\RedCode\TreeBundle\Admin\AbstractTreeAdmin扩展Admin类

class SubjectAdmin extends AbstractTreeAdmin
{
...
}

\RedCode\TreeBundle\Controller\TreeAdminController扩展AdminController

class SubjectAdminController extends TreeAdminController
{
...
}

在注册admin作为服务时,您需要提供一个第四个参数 - 将在树中显示的字段名称。

app.admin.subject:
    class: AppBundle\Admin\SubjectAdmin
    arguments: [~, AppBundle\Entity\Subject, AppBundle:SubjectAdmin, 'word']
    tags:
        - {name: sonata.admin, manager_type: orm, group: Search, label: Subject}

它看起来像什么

redcode/tree-bundle