无法在 easyAdminBundle .yml symfony 中编辑用户的角色
Can't edit the roles of the users in the easyAdminBundle .yml symfony
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'] }
这是我写的代码,这是结果:
enter image description here
你应该这样做而不是表格
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'] }
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'] }
这是我写的代码,这是结果:
enter image description here
你应该这样做而不是表格
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'] }