无法编辑easyAdminBundle.yml中的用户角色。

问题描述 投票:1回答:1
easy_admin:
entities:
    User:
        class: App\Entity\User
        disabled_actions: ['new']
        avatar_property_path: 'picture'
        form:
            fields:
                - {property: 'rank'}
                - { property: 'roles',
                    type: choice,type_options: { mapped: true, expanded: true, multiple: true},
                    choices: [role_admin: 'ROLE_ADMIN' , role_user: 'ROLE_USER'] }

这是我写的代码,这是结果。

请在这里输入图片描述

symfony symfony4 easyadmin
1个回答
0
投票

你应该这样做,而不是表单

easy_admin:
entities:
    User:
        class: App\Entity\User
        disabled_actions: ['new']
        avatar_property_path: 'picture'
        new:
            fields:
                - {property: 'rank'}
                - { property: 'roles',
                    type: choice,type_options: { mapped: true, expanded: true, multiple: true},
                    choices: [role_admin: 'ROLE_ADMIN' , role_user: 'ROLE_USER'] }
        edit:
                fields:
                    - {property: 'rank'}
                    - { property: 'roles',
                        type: choice,type_options: { mapped: true, expanded: true, multiple: true},
                        choices: [role_admin: 'ROLE_ADMIN' , role_user: 'ROLE_USER'] }
© www.soinside.com 2019 - 2024. All rights reserved.