我正在尝试使用 Doctrine Entity Provider 设置登录系统,但我总是收到此错误:
No encoder has been configured for account "Prefix\MainBundle\Entity\Admin"
这是我的设置:
安全.yml
security:
encoders:
Prefix\MainBundle\Entity\Admin:
algorithm: sha1
encode_as_base64: false
iterations: 1
role_hierarchy:
ROLE_ADMIN: ROLE_USER
ROLE_SUPER_ADMIN: [ ROLE_USER, ROLE_ADMIN, ROLE_ALLOWED_TO_SWITCH ]
providers:
administrators:
entity: { class: PrefixMainBundle:Admin, property: username }
firewalls:
administrators:
pattern: ^/admin/
anonymous: ~
provider: administrators
form_login:
login_path: /admin/login
check_path: /admin/login_check
access_control:
- { path: ^/admin/login, roles: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: ^/admin, roles: ROLE_ADMIN }
我创建了实体并实现了 UserInterface,但我无法使其工作,如果有人能对此有所了解,那就太好了。