简体   繁体   English

从管理员中删除一组字段

[英]Deleting a Group of Fields from an Admin

I tried to follow Sonata UserBundle group and row deletion method which is explained here : Official Doc Sonata 我试图遵循Sonata UserBundle组和行删除方法,在此进行了说明: 官方Doc Sonata

However if I do that nothing happens so I searched a bit on the internet but I did not find anything about it. 但是,如果执行此操作,则什么也没有发生,因此我在互联网上进行了搜索,但未找到任何相关信息。 I tried to add this : 我试图添加这个:

sonata_user:

    security_acl: true
    manager_type: orm
    admin:
        user:
            class:          Application\Sonata\UserBundle\Admin\UserAdmin
            controller:     SonataAdminBundle:CRUD

But then I come out with a big error: 但是后来我出现了一个大错误:

The autoloader expected class "Application\\Sonata\\UserBundle\\Admin\\UserAdmin" to be defined in file "C:\\wamp64\\www\\WebBundle\\vendor\\composer/../../src\\Application\\Sonata\\UserBundle\\Admin\\UserAdmin.php". 自动加载器的预期类“ Application \\ Sonata \\ UserBundle \\ Admin \\ UserAdmin”将在文件“ C:\\ wamp64 \\ www \\ WebBundle \\ vendor \\ composer /../../ src \\ Application \\ Sonata \\ UserBundle \\ Admin \\ UserAdmin.php”。 The file was found but the class was not in it, the class name or namespace probably has a typo. 找到了文件,但是类不在其中,类名或名称空间可能有错字。

I also tried to put file in AppBundle but I find myself with the same error, without putting admin : user: in the config.yml file: 我也尝试将文件放在AppBundle中,但是我发现自己也遇到了同样的错误,而没有在config.yml文件中放置admin : user: ::

The autoloader expected class "AppBundle\\Admin\\UserAdmin" to be defined in file "C:\\wamp64\\www\\WebBundle\\vendor\\composer/../../src\\AppBundle\\Admin\\UserAdmin.php". 自动加载器应在文件“ C:\\ wamp64 \\ www \\ WebBundle \\ vendor \\ composer /../../ src \\ AppBundle \\ Admin \\ UserAdmin.php”中定义“ AppBundle \\ Admin \\ UserAdmin”类。 The file was found but the class was not in it, the class name or namespace probably has a typo in C:\\wamp64\\www\\WebBundle\\app/config\\services.yml (which is being imported from "C:\\wamp64\\www\\WebBundle\\app/config\\config.yml"). 找到了文件,但是类不在其中,类名或名称空间可能在C:\\ wamp64 \\ www \\ WebBundle \\ app / config \\ services.yml中有错字(从“ C:\\ wamp64 \\ WWW \\ WebBundle \\应用/配置\\ config.yml“)。

My only suggestion would be, where you have: 我唯一的建议是,您在哪里:

sonata_user:    
    security_acl: true
    manager_type: orm
    admin:
        user:
            class:          Application\Sonata\UserBundle\Admin\UserAdmin
            controller:     SonataAdminBundle:CRUD

Try the following: 请尝试以下操作:

sonata_user:
    security_acl:           true

    manager_type: orm
    class:                  # Entity Classes
        user:               Application\Sonata\UserBundle\Entity\User
        group:              Application\Sonata\UserBundle\Entity\Group

    admin:                  # Admin Classes
        user:
            class:          Sonata\UserBundle\Admin\Entity\UserAdmin
            controller:     SonataAdminBundle:CRUD
            translation:    SonataUserBundle

As described in the official docs 官方文档中所述

I think i found a solution of that problem for the Master Version, you can go in Vendor/sonata-project/user-bundle/Admin/Model/UserAdmin and directly modify the file so you don't have to use the solution recommended in the documentation. 我想我找到了针对Master版本的解决方案,您可以进入Vendor / sonata-project / user-bundle / Admin / Model / UserAdmin并直接修改文件,因此您不必使用建议的解决方案文档。 I hope that will help some people. 我希望这会对某些人有所帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM