-1

我正在使用 symfony 2.3.4 并且在安全配置中我想根据这个Cookbook 指令从数据库中加载安全用户。但我只得到这个错误:

致命错误:MyApp\AdminBundle\Entity\Users 类包含 3 个抽象方法,因此必须声明为抽象方法或实现其余方法(Symfony\Component\Security\Core\User\UserInterface::getRoles、Symfony\Component\Security\Core\ User\UserInterface::getUsername, Symfony\Component\Security\Core\User\UserInterface::eraseCredentials) 在 /Volumes/Htdocs/symfony/src/MyApp/AdminBundle/Entity/Users.php

4

2 回答 2

5

Symfony's security framework expects the User entity to implement the UserInterface. Implement the three methods:

public function getRoles()
public function getUsername()
public function eraseCredentials()
于 2013-09-05T08:44:34.277 回答
0

只需从接口实现方法。;)

于 2013-09-05T08:43:52.943 回答