-1

I'm using symfony 2.3.4 and in security configuration I want to to load Security Users from the Database accordingly to this Cookbook instruction. But I only get this error:

Fatal error: Class MyApp\AdminBundle\Entity\Users contains 3 abstract methods and must therefore be declared abstract or implement the remaining methods (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

1
  • Can you post the code of the Users class?? It seems you did not implement the three methods which are defined by the "UserInterface" interface.
    – Benny
    Sep 5, 2013 at 8:40

2 Answers 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()
1
  • I don't see a user interface at all. Should that be implemented manually or it can be auto generated ? Please help. Jul 30, 2019 at 7:48
0

Just implement the methods from the interface. ;)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.