Advertisement
n0rthway

knp-user-entity

May 30th, 2017
152
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.18 KB | None | 0 0
  1. <?php
  2.  
  3. namespace AppBundle\Entity;
  4.  
  5. //use Symfony\Component\Security\Core\Role\Role;
  6. use Symfony\Component\Security\Core\User\UserInterface;
  7. use Doctrine\ORM\Mapping as ORM;
  8.  
  9. /**
  10.  * @ORM\Entity(repositoryClass="AppBundle\Repository\UserRepository")
  11.  * @ORM\Table(name="user")
  12.  */
  13. class User implements UserInterface
  14. {
  15.  
  16.     /**
  17.      * @ORM\Id
  18.      * @ORM\GeneratedValue(strategy="AUTO")
  19.      * @ORM\Column(type="integer")
  20.      */
  21.     private $id;
  22.  
  23.     /**
  24.      * @ORM\Column(type="string", unique=true)
  25.      */
  26.     private $email;
  27.  
  28.     public function getRoles()
  29.     {
  30.         return ['ROLE_USER'];
  31.     }
  32.  
  33.     public function getPassword()
  34.     {
  35.         // leaving blank - I don't need/have a password!
  36.     }
  37.  
  38.     public function getSalt()
  39.     {
  40.         // leaving blank - I don't need/have a password!
  41.     }
  42.  
  43.     public function getUsername()
  44.     {
  45.         return $this->email;
  46.     }
  47.  
  48.     public function eraseCredentials()
  49.     {
  50.         // leaving blank - I don't need/have a password!
  51.     }
  52.  
  53.     public function getEmail()
  54.     {
  55.         return $this->email;
  56.     }
  57.  
  58.     public function setEmail($email)
  59.     {
  60.         $this->email = $email;
  61.     }
  62. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement