src/Entity/DistributorUsers.php line 13

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