Symfony2 用户实体提供程序中的致命错误


Symfony2 Fatal error in Users Entity Provider

我正在使用symfony 2.3.4,在安全配置中,我想根据此食谱指令从数据库加载安全用户。但我只收到此错误:

致命错误:类 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) in/Volumes/Htdocs/symfony/src/MyApp/AdminBundle/Entity/Users.php

Symfony的安全框架期望用户实体实现UserInterface。实现三种方法:

public function getRoles()
public function getUsername()
public function eraseCredentials()

只需从接口实现方法即可;)

相关文章: