Php Symfony easy admin Bundle设置/分配用户角色

Php Symfony easy admin Bundle设置/分配用户角色,php,symfony,authentication,easyadmin,Php,Symfony,Authentication,Easyadmin,我正在尝试配置easy admin配置 这是我与用户的数据库结构 user (Table) _____ id username password email 现在,当我尝试登录时,我知道构造需要某种用户角色。 因为这个错误出现了 传递给Symfony\Component\Security\Guard\Token\PostAuthenticationGuardToken::\uu构造()的参数3必须是第37行的\AbstractGuardAuthenticator.php中调用的数组类型(给定n

我正在尝试配置easy admin配置

这是我与用户的数据库结构

user (Table)
_____
id
username
password
email
现在,当我尝试登录时,我知道构造需要某种用户角色。 因为这个错误出现了

传递给Symfony\Component\Security\Guard\Token\PostAuthenticationGuardToken::\uu构造()的参数3必须是第37行的\AbstractGuardAuthenticator.php中调用的数组类型(给定null)

所以我的问题是如何为我的用户分配角色

这是我的配置

在我的
security.yml
文件中,我有这些配置

security:
# https://symfony.com/doc/current/security.html#where-do-users-come-from-user-providers
providers:
    in_memory: { memory: null }
firewalls:
    dev:
        pattern: ^/(_(profiler|wdt)|css|images|js)/
        security: false
    main:
        anonymous: true
        guard:
            authenticators:
                - App\Security\AuthAuthenticator
        logout:
            path: app_logout
            # where to redirect after logout
            # target: app_any_route

        # activate different ways to authenticate
        # https://symfony.com/doc/current/security.html#firewalls-authentication

        # https://symfony.com/doc/current/security/impersonating_user.html
        # switch_user: true

# Easy way to control access for large sections of your site
# Note: Only the *first* access control that matches will be used
access_control:
     - { path: ^/login, roles: IS_AUTHENTICATED_ANONYMOUSLY }
     - { path: ^/, roles: IS_AUTHENTICATED_FULLY }
我的
easy\u admin.yml
是空的

如果您需要任何其他信息,请告诉我

多谢各位

您应该将“角色”属性添加到
用户
表中,如Symfony安全文档中所述:


用户注册时是否有角色?没有注册,我只是将他们添加到数据库中。只需在数据库中的字段role中添加[“role\u user”]。我没有角色字段。。。这就是问题所在。我自动生成了表,但没有得到任何角色字段。这对于
php-bin/console-make:user来说很奇怪,应该自动创建字段角色