![](/img/trans.png)
[英]Symfony2 Authenticating Someone with a Custom Entity Provider ERROR
[英]Symfony2 Fatal error in Users Entity Provider
我使用的是symfony 2.3.4,在安全配置中,我想從數據庫中向此Cookbook指令加載安全用戶。 但是我只得到這個錯誤:
致命錯誤:類MyApp \\ AdminBundle \\ Entity \\ Users包含3個抽象方法,因此必須聲明為抽象或實現其余方法(Symfony \\ Component \\ Security \\ Core \\ User \\ UserInterface :: getRoles,Symfony \\ Component \\ Security \\ Core \\ /Volumes/Htdocs/symfony/src/MyApp/AdminBundle/Entity/Users.php中的User \\ UserInterface :: getUsername,Symfony \\ Component \\ Security \\ Core \\ User \\ UserInterface :: eraseCredentials)
Symfony的安全框架期望User實體實現UserInterface
。 實現三種方法:
public function getRoles()
public function getUsername()
public function eraseCredentials()
只需從接口實現方法即可。 ;)
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.