src/Entity/User.php line 14

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\UserRepository;
  4. use Doctrine\ORM\Mapping as ORM;
  5. use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
  6. use Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface;
  7. use Symfony\Component\Security\Core\User\UserInterface;
  8. #[ORM\Entity(repositoryClassUserRepository::class)]
  9. #[ORM\Table(name'`user`')]
  10. #[UniqueEntity(fields: ['email'], message'There is already an account with this email')]
  11. class User implements UserInterfacePasswordAuthenticatedUserInterface
  12. {
  13.     #[ORM\Id]
  14.     #[ORM\GeneratedValue]
  15.     #[ORM\Column]
  16.     private ?int $id null;
  17.     #[ORM\Column(length180uniquetrue)]
  18.     private ?string $email null;
  19.     #[ORM\Column]
  20.     private array $roles = [];
  21.     /**
  22.      * @var string The hashed password
  23.      */
  24.     #[ORM\Column]
  25.     private ?string $password null;
  26.     #[ORM\Column(type'boolean')]
  27.     private $isVerified false;
  28.     #[ORM\Column(length255)]
  29.     private ?string $surname null;
  30.     #[ORM\Column(length255)]
  31.     private ?string $firstname null;
  32.     #[ORM\Column(length255nullabletrue)]
  33.     private ?string $phone null;
  34.     #[ORM\Column(length255)]
  35.     private ?string $zipcode null;
  36.     #[ORM\Column(length255)]
  37.     private ?string $city null;
  38.     #[ORM\Column(length255)]
  39.     private ?string $adress null;
  40.     #[ORM\Column(length255nullabletrue)]
  41.     private ?string $additionalAdressInformation null;
  42.     public function getId(): ?int
  43.     {
  44.         return $this->id;
  45.     }
  46.     public function getEmail(): ?string
  47.     {
  48.         return $this->email;
  49.     }
  50.     public function setEmail(string $email): static
  51.     {
  52.         $this->email $email;
  53.         return $this;
  54.     }
  55.     /**
  56.      * A visual identifier that represents this user.
  57.      *
  58.      * @see UserInterface
  59.      */
  60.     public function getUserIdentifier(): string
  61.     {
  62.         return (string) $this->email;
  63.     }
  64.     /**
  65.      * @see UserInterface
  66.      */
  67.     public function getRoles(): array
  68.     {
  69.         $roles $this->roles;
  70.         // guarantee every user at least has ROLE_USER
  71.         $roles[] = 'ROLE_USER';
  72.         return array_unique($roles);
  73.     }
  74.     public function setRoles(array $roles): static
  75.     {
  76.         $this->roles $roles;
  77.         return $this;
  78.     }
  79.     /**
  80.      * @see PasswordAuthenticatedUserInterface
  81.      */
  82.     public function getPassword(): string
  83.     {
  84.         return $this->password;
  85.     }
  86.     public function setPassword(string $password): static
  87.     {
  88.         $this->password $password;
  89.         return $this;
  90.     }
  91.     /**
  92.      * @see UserInterface
  93.      */
  94.     public function eraseCredentials(): void
  95.     {
  96.         // If you store any temporary, sensitive data on the user, clear it here
  97.         // $this->plainPassword = null;
  98.     }
  99.     public function isVerified(): bool
  100.     {
  101.         return $this->isVerified;
  102.     }
  103.     public function setIsVerified(bool $isVerified): static
  104.     {
  105.         $this->isVerified $isVerified;
  106.         return $this;
  107.     }
  108.     public function getSurname(): ?string
  109.     {
  110.         return $this->surname;
  111.     }
  112.     public function setSurname(string $surname): static
  113.     {
  114.         $this->surname $surname;
  115.         return $this;
  116.     }
  117.     public function getFirstname(): ?string
  118.     {
  119.         return $this->firstname;
  120.     }
  121.     public function setFirstname(string $firstname): static
  122.     {
  123.         $this->firstname $firstname;
  124.         return $this;
  125.     }
  126.     public function getPhone(): ?string
  127.     {
  128.         return $this->phone;
  129.     }
  130.     public function setPhone(string $phone): static
  131.     {
  132.         $this->phone $phone;
  133.         return $this;
  134.     }
  135.     public function getZipcode(): ?string
  136.     {
  137.         return $this->zipcode;
  138.     }
  139.     public function setZipcode(string $zipcode): static
  140.     {
  141.         $this->zipcode $zipcode;
  142.         return $this;
  143.     }
  144.     public function getCity(): ?string
  145.     {
  146.         return $this->city;
  147.     }
  148.     public function setCity(string $city): static
  149.     {
  150.         $this->city $city;
  151.         return $this;
  152.     }
  153.     public function getAdress(): ?string
  154.     {
  155.         return $this->adress;
  156.     }
  157.     public function setAdress(string $adress): static
  158.     {
  159.         $this->adress $adress;
  160.         return $this;
  161.     }
  162.     public function getAdditionalAdressInformation(): ?string
  163.     {
  164.         return $this->additionalAdressInformation;
  165.     }
  166.     public function setAdditionalAdressInformation(?string $additionalAdressInformation): static
  167.     {
  168.         $this->additionalAdressInformation $additionalAdressInformation;
  169.         return $this;
  170.     }
  171. }