Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- namespace App\Entity;
- use Doctrine\ORM\Mapping as ORM;
- use Symfony\Component\Validator\Constraints as Assert;
- use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
- use Symfony\Component\Security\Core\User\UserInterface;
- /**
- * @ORM\Entity(repositoryClass="App\Repository\UserRepository")
- * @UniqueEntity(fields="email", message="Email already taken")
- */
- class User implements UserInterface
- {
- /**
- * @ORM\Id()
- * @ORM\GeneratedValue()
- * @ORM\Column(type="integer")
- */
- private $id;
- /**
- * @ORM\Column(type="string")
- * @Assert\NotBlank()
- * @Assert\Length(min=6, max=100)
- */
- private $username;
- /**
- * @ORM\Column(type="string", length=255, unique=true)
- * @Assert\NotBlank()
- * @Assert\Email
- */
- private $email;
- /**
- * @Assert\NotBlank
- * @Assert\Length(max=4096)
- */
- private $plainPassword;
- /**
- * @ORM\Column(type="string", length=64)
- */
- private $password;
- /**
- * @ORM\Column(type="array")
- */
- private $roles;
- public function __construct()
- {
- $this->roles = array('ROLE_USER');
- }
- public function getUsername(){
- return $this->username;
- }
- public function setUsername($username){
- $this->username = $username;
- }
- public function getEmail()
- {
- return $this->email;
- }
- public function setEmail($email)
- {
- $this->email = $email;
- }
- public function getPlainPassword()
- {
- return $this->plainPassword;
- }
- public function setPlainPassword($password)
- {
- $this->plainPassword = $password;
- }
- public function getPassword()
- {
- return $this->password;
- }
- public function setPassword($password)
- {
- $this->password = $password;
- }
- public function getSalt()
- {
- return null;
- }
- public function getRoles()
- {
- return $this->roles;
- }
- public function eraseCredentials()
- {
- }
- public function getId(): int
- {
- return $this->id;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement