SHARE
TWEET

Untitled

a guest Oct 4th, 2017 56 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2.  
  3. namespace AppBundle\Entity;
  4.  
  5. use Doctrine\ORM\Mapping as ORM;
  6. use Symfony\Component\Security\Core\User\UserInterface;
  7. use Symfony\Component\Validator\Constraints as Assert;
  8.  
  9. /**
  10.  * A user.
  11.  *
  12.  * @ORM\Entity(repositoryClass="AppBundle\Repository\UserRepository")
  13.  */
  14. class User implements UserInterface, \Serializable
  15. {
  16.     /**
  17.      * @var integer
  18.      *
  19.      * @ORM\Column(type="integer")
  20.      * @ORM\Id
  21.      * @ORM\GeneratedValue(strategy="AUTO")
  22.      */
  23.     private $id;
  24.  
  25.     /**
  26.      * @var string
  27.      *
  28.      * @ORM\Column(type="string", unique=true)
  29.      * @Assert\NotBlank
  30.      * @AssertLength(max=255)
  31.      */
  32.     private $username;
  33.  
  34.     /**
  35.      * @var string
  36.      *
  37.      * @ORM\Column(type="string")
  38.      */
  39.     private $password;
  40.  
  41.     /**
  42.      * @var string
  43.      *
  44.      * @ORM\Column(type="string", length=60, unique=true)
  45.      * @Assert\NotBlank
  46.      * @Assert\Email
  47.      */
  48.     private $email;
  49.  
  50.     /**
  51.      * @var boolean
  52.      *
  53.      * @ORM\Column(name="is_active", type="boolean")
  54.      */
  55.     private $active = true;
  56.  
  57.     public function getUsername(): ?string
  58.     {
  59.         return $this->username;
  60.     }
  61.  
  62.     public function getSalt():  ?string
  63.     {
  64.         return null;
  65.     }
  66.  
  67.     public function getPassword(): ?string
  68.     {
  69.         return $this->password;
  70.     }
  71.  
  72.     public function getRoles(): array
  73.     {
  74.         return ['ROLE_USER'];
  75.     }
  76.  
  77.     public function eraseCredentials(): void
  78.     {
  79.     }
  80.  
  81.     public function serialize(): string
  82.     {
  83.         return serialize([
  84.             $this->id,
  85.             $this->username,
  86.             $this->password
  87.         ]);
  88.     }
  89.  
  90.     public function unserialize(string $serialized)
  91.     {
  92.         [$this->id, $this->username, $this->password] = unserialize($serialized);
  93.     }
  94.  
  95.     public function getId(): ?int
  96.     {
  97.         return $this->id;
  98.     }
  99.  
  100.     public function setId(int $id)
  101.     {
  102.         $this->id = $id;
  103.     }
  104.  
  105.     public function getEmail(): ?string
  106.     {
  107.         return $this->email;
  108.     }
  109.  
  110.     public function setEmail(string $email)
  111.     {
  112.         $this->email = $email;
  113.     }
  114.  
  115.     public function isActive(): bool
  116.     {
  117.         return $this->active;
  118.     }
  119.  
  120.     public function setActive(bool $isActive): void
  121.     {
  122.         $this->isActive = $isActive;
  123.     }
  124.  
  125.     public function setUsername(string $username): void
  126.     {
  127.         $this->username = $username;
  128.     }
  129.  
  130.     public function setPassword(string $password): void
  131.     {
  132.         $this->password = $password;
  133.     }
  134. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top