Advertisement
Guest User

Untitled

a guest
Dec 3rd, 2018
138
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.22 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(repositoryClass="App\Repository\UserRepository")
  12.  * @UniqueEntity(fields="email", message="Email already taken")
  13.  */
  14. class User implements UserInterface
  15. {
  16.     /**
  17.      * @ORM\Id()
  18.      * @ORM\GeneratedValue()
  19.      * @ORM\Column(type="integer")
  20.      */
  21.     private $id;
  22.    
  23.     /**
  24.      * @ORM\Column(type="string")
  25.      * @Assert\NotBlank()
  26.      * @Assert\Length(min=6, max=100)
  27.      */
  28.     private $username;
  29.    
  30.     /**
  31.      * @ORM\Column(type="string", length=255, unique=true)
  32.      * @Assert\NotBlank()
  33.      * @Assert\Email
  34.      */
  35.     private $email;
  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.     /**
  49.      * @ORM\Column(type="array")
  50.      */
  51.     private $roles;
  52.  
  53.     public function __construct()
  54.     {
  55.         $this->roles = array('ROLE_USER');
  56.     }
  57.    
  58.     public function getUsername(){
  59.         return $this->username;
  60.     }
  61.    
  62.     public function setUsername($username){
  63.         $this->username = $username;
  64.     }
  65.    
  66.     public function getEmail()
  67.     {
  68.         return $this->email;
  69.     }
  70.  
  71.     public function setEmail($email)
  72.     {
  73.         $this->email = $email;
  74.     }
  75.    
  76.      public function getPlainPassword()
  77.     {
  78.         return $this->plainPassword;
  79.     }
  80.  
  81.     public function setPlainPassword($password)
  82.     {
  83.         $this->plainPassword = $password;
  84.     }
  85.  
  86.     public function getPassword()
  87.     {
  88.         return $this->password;
  89.     }
  90.  
  91.     public function setPassword($password)
  92.     {
  93.         $this->password = $password;
  94.     }
  95.    
  96.     public function getSalt()
  97.     {
  98.         return null;
  99.     }
  100.    
  101.     public function getRoles()
  102.     {
  103.         return $this->roles;
  104.     }
  105.    
  106.     public function eraseCredentials()
  107.     {
  108.        
  109.     }
  110.    
  111.     public function getId(): int
  112.     {
  113.         return $this->id;
  114.     }
  115. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement