Advertisement
Guest User

User Entity

a guest
Jul 22nd, 2018
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.10 KB | None | 0 0
  1. <?php
  2.  
  3. namespace App\Entity;
  4.  
  5. use Doctrine\ORM\Mapping as ORM;
  6. use Symfony\Component\Validator\Constraints as Assert;
  7. use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
  8. use Symfony\Component\Security\Core\User\UserInterface;
  9.  
  10. /**
  11.  * @ORM\Entity
  12.  * @UniqueEntity(fields="email", message="Email already taken")
  13.  * @UniqueEntity(fields="username", message="Username already taken")
  14.  */
  15. class User implements UserInterface
  16. {
  17.     /**
  18.      * @ORM\Id
  19.      * @ORM\Column(type="integer")
  20.      * @ORM\GeneratedValue(strategy="AUTO")
  21.      */
  22.     private $id;
  23.  
  24.     /**
  25.      * @ORM\Column(type="string", length=255, unique=true)
  26.      * @Assert\NotBlank()
  27.      * @Assert\Email()
  28.      */
  29.     private $email;
  30.  
  31.     /**
  32.      * @ORM\Column(type="string", length=255, unique=true)
  33.      * @Assert\NotBlank()
  34.      */
  35.     private $username;
  36.  
  37.     /**
  38.      * @Assert\NotBlank()
  39.      * @Assert\Length(max=4096)
  40.      */
  41.     private $plainPassword;
  42.  
  43.     /**
  44.      * @ORM\Column(type="string", length=64)
  45.      */
  46.     private $password;
  47.  
  48.     private $isActive;
  49.    
  50.     private $roles;
  51.  
  52.     public function __construct()
  53.     {
  54.         $this->roles = array('ROLE_USER');
  55.     }
  56.  
  57.     public function getEmail()
  58.     {
  59.         return $this->email;
  60.     }
  61.  
  62.     public function setEmail($email)
  63.     {
  64.         $this->email = $email;
  65.     }
  66.  
  67.     public function getUsername()
  68.     {
  69.         return $this->username;
  70.     }
  71.  
  72.     public function setUsername($username)
  73.     {
  74.         $this->username = $username;
  75.     }
  76.  
  77.     public function getPlainPassword()
  78.     {
  79.         return $this->plainPassword;
  80.     }
  81.  
  82.     public function setPlainPassword($password)
  83.     {
  84.         $this->plainPassword = $password;
  85.     }
  86.  
  87.     public function getPassword()
  88.     {
  89.         return $this->password;
  90.     }
  91.  
  92.     public function setPassword($password)
  93.     {
  94.         $this->password = $password;
  95.     }
  96.  
  97.     public function getSalt()
  98.     {
  99.         return null;
  100.     }
  101.  
  102.     public function getRoles()
  103.     {
  104.         return $this->roles;
  105.     }
  106.  
  107.     public function eraseCredentials()
  108.     {
  109.     }
  110. }
  111.  
  112. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement