I am trying to work with the symfony2 login. I have my entity class connected to the database. In my table, I have only the user’s email, which is the username. Should I use the getUsername() method knowing that I don’t have a real username.
When I try to delete this method, I am geting a fatal error message :
Fatal error: Class MDPI\BackendBundle\Entity\Users contains 1 abstract method and must therefore be declared abstract or implement the remaining methods (Symfony\Component\Security\Core\User\UserInterface::getUsername) in /home/milos/workspace/mdpi-login2/src/MDPI/BackendBundle/Entity/Users.php on line 768
Should I use
getUsername()
{
return this->email;
}
Or is there a nicer way of doing this ???
Thank you.
Using the native Symfony SecurityBundle, you just have to specify the entity field you use as login string, in
app/config/security.yml: