src/Entity/ManufacturerUsers.php line 11

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\ManufacturerUsersRepository;
  4. use Doctrine\ORM\Mapping as ORM;
  5. use Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface;
  6. use Symfony\Component\Security\Core\User\UserInterface;
  7. #[ORM\Entity(repositoryClassManufacturerUsersRepository::class)]
  8. class ManufacturerUsers implements UserInterfacePasswordAuthenticatedUserInterface
  9. {
  10.     #[ORM\Id]
  11.     #[ORM\GeneratedValue]
  12.     #[ORM\Column(type'integer')]
  13.     private $id;
  14.     #[ORM\ManyToOne(targetEntityManufacturers::class, inversedBy'manufacturerUsers')]
  15.     private $manufacturer;
  16.     #[ORM\Column(type'string'length255)]
  17.     private $firstName;
  18.     #[ORM\Column(type'string'length255)]
  19.     private $lastName;
  20.     #[ORM\Column(type'string'length255)]
  21.     private $email;
  22.     #[ORM\Column(type'string'length255)]
  23.     private $hashedEmail;
  24.     /**
  25.      * @var string The hashed password
  26.      */
  27.     #[ORM\Column(type'string')]
  28.     private $password;
  29.     #[ORM\Column(type'string'length255)]
  30.     private $telephone;
  31.     #[ORM\Column(type'string'length255)]
  32.     private $isoCode;
  33.     #[ORM\Column(type'string'length255)]
  34.     private $intlCode;
  35.     #[ORM\Column(type'json')]
  36.     private $roles = [];
  37.     #[ORM\Column(type'string'length255)]
  38.     private $resetKey;
  39.     #[ORM\Column(type'boolean')]
  40.     private $isPrimary;
  41.     #[ORM\Column(type'datetime')]
  42.     private $modified;
  43.     #[ORM\Column(type'datetime')]
  44.     private $created;
  45.     public function __construct()
  46.     {
  47.         $this->setModified(new \DateTime());
  48.         if ($this->getCreated() == null) {
  49.             $this->setCreated(new \DateTime());
  50.         }
  51.     }
  52.     public function getId(): ?int
  53.     {
  54.         return $this->id;
  55.     }
  56.     public function getManufacturer(): ?Manufacturers
  57.     {
  58.         return $this->manufacturer;
  59.     }
  60.     public function setManufacturer(?Manufacturers $manufacturer): self
  61.     {
  62.         $this->manufacturer $manufacturer;
  63.         return $this;
  64.     }
  65.     public function getFirstName(): ?string
  66.     {
  67.         return $this->firstName;
  68.     }
  69.     public function setFirstName(string $firstName): self
  70.     {
  71.         $this->firstName $firstName;
  72.         return $this;
  73.     }
  74.     public function getLastName(): ?string
  75.     {
  76.         return $this->lastName;
  77.     }
  78.     public function setLastName(string $lastName): self
  79.     {
  80.         $this->lastName $lastName;
  81.         return $this;
  82.     }
  83.     public function getEmail(): ?string
  84.     {
  85.         return $this->email;
  86.     }
  87.     public function setEmail(string $email): self
  88.     {
  89.         $this->email $email;
  90.         return $this;
  91.     }
  92.     public function getHashedEmail(): ?string
  93.     {
  94.         return $this->hashedEmail;
  95.     }
  96.     public function setHashedEmail(string $hashedEmail): self
  97.     {
  98.         $this->hashedEmail $hashedEmail;
  99.         return $this;
  100.     }
  101.     public function getTelephone(): ?string
  102.     {
  103.         return $this->telephone;
  104.     }
  105.     public function setTelephone(string $telephone): self
  106.     {
  107.         $this->telephone $telephone;
  108.         return $this;
  109.     }
  110.     public function getIsoCode(): ?string
  111.     {
  112.         return $this->isoCode;
  113.     }
  114.     public function setIsoCode(string $isoCode): self
  115.     {
  116.         $this->isoCode $isoCode;
  117.         return $this;
  118.     }
  119.     public function getIntlCode(): ?string
  120.     {
  121.         return $this->intlCode;
  122.     }
  123.     public function setIntlCode(string $intlCode): self
  124.     {
  125.         $this->intlCode $intlCode;
  126.         return $this;
  127.     }
  128.     public function getResetKey(): ?string
  129.     {
  130.         return $this->resetKey;
  131.     }
  132.     public function setResetKey(string $resetKey): self
  133.     {
  134.         $this->resetKey $resetKey;
  135.         return $this;
  136.     }
  137.     public function getIsPrimary(): ?bool
  138.     {
  139.         return $this->isPrimary;
  140.     }
  141.     public function setIsPrimary(bool $isPrimary): self
  142.     {
  143.         $this->isPrimary $isPrimary;
  144.         return $this;
  145.     }
  146.     public function getModified(): ?\DateTimeInterface
  147.     {
  148.         return $this->modified;
  149.     }
  150.     public function setModified(\DateTimeInterface $modified): self
  151.     {
  152.         $this->modified $modified;
  153.         return $this;
  154.     }
  155.     public function getCreated(): ?\DateTimeInterface
  156.     {
  157.         return $this->created;
  158.     }
  159.     public function setCreated(\DateTimeInterface $created): self
  160.     {
  161.         $this->created $created;
  162.         return $this;
  163.     }
  164.     /**
  165.      * A visual identifier that represents this user.
  166.      *
  167.      * @see UserInterface
  168.      */
  169.     public function getUserIdentifier(): string
  170.     {
  171.         return (string) $this->email;
  172.     }
  173.     /**
  174.      * @deprecated since Symfony 5.3, use getUserIdentifier instead
  175.      */
  176.     public function getUsername(): string
  177.     {
  178.         return (string) $this->email;
  179.     }
  180.     /**
  181.      * @see UserInterface
  182.      */
  183.     public function getRoles(): array
  184.     {
  185.         $roles $this->roles;
  186.         // guarantee every user at least has ROLE_USER
  187.         $roles[] = 'ROLE_USER';
  188.         return array_unique($roles);
  189.     }
  190.     public function setRoles(array $roles): self
  191.     {
  192.         $this->roles $roles;
  193.         return $this;
  194.     }
  195.     /**
  196.      * @see PasswordAuthenticatedUserInterface
  197.      */
  198.     public function getPassword(): string
  199.     {
  200.         return $this->password;
  201.     }
  202.     public function setPassword(string $password): self
  203.     {
  204.         $this->password $password;
  205.         return $this;
  206.     }
  207.     /**
  208.      * Returning a salt is only needed, if you are not using a modern
  209.      * hashing algorithm (e.g. bcrypt or sodium) in your security.yaml.
  210.      *
  211.      * @see UserInterface
  212.      */
  213.     public function getSalt(): ?string
  214.     {
  215.         return null;
  216.     }
  217.     /**
  218.      * @see UserInterface
  219.      */
  220.     public function eraseCredentials()
  221.     {
  222.         // If you inventory any temporary, sensitive data on the user, clear it here
  223.         // $this->plainPassword = null;
  224.     }
  225. }