src/Entity/RetailUsers.php line 13

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\RetailUsersRepository;
  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(repositoryClassRetailUsersRepository::class)]
  10. class RetailUsers implements UserInterfacePasswordAuthenticatedUserInterface
  11. {
  12.     #[ORM\Id]
  13.     #[ORM\GeneratedValue]
  14.     #[ORM\Column(type'integer')]
  15.     private $id;
  16.     #[ORM\Column(type'string'length255nullabletrue)]
  17.     private $firstName;
  18.     #[ORM\Column(type'string'length255nullabletrue)]
  19.     private $lastName;
  20.     #[ORM\Column(type'string'length255)]
  21.     private $email;
  22.     #[ORM\Column(type'string'length255)]
  23.     private $hashedEmail;
  24.     #[ORM\Column(type'string'length255)]
  25.     private $password;
  26.     #[ORM\Column(type'string'length255)]
  27.     private $telephone;
  28.     #[ORM\Column(type'string'length255)]
  29.     private $isoCode;
  30.     #[ORM\Column(type'string'length255)]
  31.     private $intlCode;
  32.     #[ORM\Column(type'json')]
  33.     private $roles = [];
  34.     #[ORM\Column(type'string'length255nullabletrue)]
  35.     private $resetKey;
  36.     #[ORM\Column(type'datetime')]
  37.     private $modified;
  38.     #[ORM\Column(type'datetime')]
  39.     private $created;
  40.     #[ORM\OneToMany(targetEntityAddresses::class, mappedBy'retail')]
  41.     private $addresses;
  42.     #[ORM\OneToMany(targetEntityClinicRetailUsers::class, mappedBy'retailUser')]
  43.     private $clinicRetailUsers;
  44.     #[ORM\ManyToOne(targetEntityCountries::class, inversedBy'retailUsers')]
  45.     #[ORM\JoinColumn(nullablefalse)]
  46.     private $country;
  47.     #[ORM\OneToMany(targetEntityBaskets::class, mappedBy'retailUser')]
  48.     private $baskets;
  49.     #[ORM\OneToMany(targetEntityOrders::class, mappedBy'retail')]
  50.     private $orders;
  51.     #[ORM\Column(type'integer'nullabletrue)]
  52.     private $clinicId;
  53.     public function __construct()
  54.     {
  55.         $this->setModified(new \DateTime());
  56.         if ($this->getCreated() == null) {
  57.             $this->setCreated(new \DateTime());
  58.         }
  59.         $this->addresses = new ArrayCollection();
  60.         $this->clinicRetailUsers = new ArrayCollection();
  61.         $this->baskets = new ArrayCollection();
  62.         $this->orders = new ArrayCollection();
  63.     }
  64.     public function getId(): ?int
  65.     {
  66.         return $this->id;
  67.     }
  68.     public function getFirstName(): ?string
  69.     {
  70.         return $this->firstName;
  71.     }
  72.     public function setFirstName(?string $firstName): self
  73.     {
  74.         $this->firstName $firstName;
  75.         return $this;
  76.     }
  77.     public function getLastName(): ?string
  78.     {
  79.         return $this->lastName;
  80.     }
  81.     public function setLastName(?string $lastName): self
  82.     {
  83.         $this->lastName $lastName;
  84.         return $this;
  85.     }
  86.     public function getEmail(): ?string
  87.     {
  88.         return $this->email;
  89.     }
  90.     public function setEmail(string $email): self
  91.     {
  92.         $this->email $email;
  93.         return $this;
  94.     }
  95.     public function getHashedEmail(): ?string
  96.     {
  97.         return $this->hashedEmail;
  98.     }
  99.     public function setHashedEmail(string $hashedEmail): self
  100.     {
  101.         $this->hashedEmail $hashedEmail;
  102.         return $this;
  103.     }
  104.     public function getTelephone(): ?string
  105.     {
  106.         return $this->telephone;
  107.     }
  108.     public function setTelephone(string $telephone): self
  109.     {
  110.         $this->telephone $telephone;
  111.         return $this;
  112.     }
  113.     public function getIsoCode(): ?string
  114.     {
  115.         return $this->isoCode;
  116.     }
  117.     public function setIsoCode(string $isoCode): self
  118.     {
  119.         $this->isoCode $isoCode;
  120.         return $this;
  121.     }
  122.     public function getIntlCode(): ?string
  123.     {
  124.         return $this->intlCode;
  125.     }
  126.     public function setIntlCode(string $intlCode): self
  127.     {
  128.         $this->intlCode $intlCode;
  129.         return $this;
  130.     }
  131.     public function getResetKey(): ?string
  132.     {
  133.         return $this->resetKey;
  134.     }
  135.     public function setResetKey(?string $resetKey): self
  136.     {
  137.         $this->resetKey $resetKey;
  138.         return $this;
  139.     }
  140.     public function getModified(): ?\DateTimeInterface
  141.     {
  142.         return $this->modified;
  143.     }
  144.     public function setModified(\DateTimeInterface $modified): self
  145.     {
  146.         $this->modified $modified;
  147.         return $this;
  148.     }
  149.     public function getCreated(): ?\DateTimeInterface
  150.     {
  151.         return $this->created;
  152.     }
  153.     public function setCreated(\DateTimeInterface $created): self
  154.     {
  155.         $this->created $created;
  156.         return $this;
  157.     }
  158.     /**
  159.      * A visual identifier that represents this user.
  160.      *
  161.      * @see UserInterface
  162.      */
  163.     public function getUserIdentifier(): string
  164.     {
  165.         return (string) $this->email;
  166.     }
  167.     /**
  168.      * @deprecated since Symfony 5.3, use getUserIdentifier instead
  169.      */
  170.     public function getUsername(): string
  171.     {
  172.         return (string) $this->email;
  173.     }
  174.     /**
  175.      * @see UserInterface
  176.      */
  177.     public function getRoles(): array
  178.     {
  179.         $roles $this->roles;
  180.         // guarantee every user at least has ROLE_USER
  181.         $roles[] = 'ROLE_USER';
  182.         return array_unique($roles);
  183.     }
  184.     public function setRoles(array $roles): self
  185.     {
  186.         $this->roles $roles;
  187.         return $this;
  188.     }
  189.     /**
  190.      * @see PasswordAuthenticatedUserInterface
  191.      */
  192.     public function getPassword(): string
  193.     {
  194.         return $this->password;
  195.     }
  196.     public function setPassword(string $password): self
  197.     {
  198.         $this->password $password;
  199.         return $this;
  200.     }
  201.     /**
  202.      * Returning a salt is only needed, if you are not using a modern
  203.      * hashing algorithm (e.g. bcrypt or sodium) in your security.yaml.
  204.      *
  205.      * @see UserInterface
  206.      */
  207.     public function getSalt(): ?string
  208.     {
  209.         return null;
  210.     }
  211.     /**
  212.      * @see UserInterface
  213.      */
  214.     public function eraseCredentials()
  215.     {
  216.         // If you inventory any temporary, sensitive data on the user, clear it here
  217.         // $this->plainPassword = null;
  218.     }
  219.     /**
  220.      * @return Collection<int, Addresses>
  221.      */
  222.     public function getAddresses(): Collection
  223.     {
  224.         return $this->addresses;
  225.     }
  226.     public function addAddress(Addresses $address): self
  227.     {
  228.         if (!$this->addresses->contains($address)) {
  229.             $this->addresses[] = $address;
  230.             $address->setRetail($this);
  231.         }
  232.         return $this;
  233.     }
  234.     public function removeAddress(Addresses $address): self
  235.     {
  236.         if ($this->addresses->removeElement($address)) {
  237.             // set the owning side to null (unless already changed)
  238.             if ($address->getRetail() === $this) {
  239.                 $address->setRetail(null);
  240.             }
  241.         }
  242.         return $this;
  243.     }
  244.     /**
  245.      * @return Collection<int, ClinicRetailUsers>
  246.      */
  247.     public function getClinicRetailUsers(): Collection
  248.     {
  249.         return $this->clinicRetailUsers;
  250.     }
  251.     public function addClinicRetailUser(ClinicRetailUsers $clinicRetailUser): self
  252.     {
  253.         if (!$this->clinicRetailUsers->contains($clinicRetailUser)) {
  254.             $this->clinicRetailUsers[] = $clinicRetailUser;
  255.             $clinicRetailUser->setRetailUser($this);
  256.         }
  257.         return $this;
  258.     }
  259.     public function removeClinicRetailUser(ClinicRetailUsers $clinicRetailUser): self
  260.     {
  261.         if ($this->clinicRetailUsers->removeElement($clinicRetailUser)) {
  262.             // set the owning side to null (unless already changed)
  263.             if ($clinicRetailUser->getRetailUser() === $this) {
  264.                 $clinicRetailUser->setRetailUser(null);
  265.             }
  266.         }
  267.         return $this;
  268.     }
  269.     public function getCountry(): ?Countries
  270.     {
  271.         return $this->country;
  272.     }
  273.     public function setCountry(?Countries $country): self
  274.     {
  275.         $this->country $country;
  276.         return $this;
  277.     }
  278.     /**
  279.      * @return Collection<int, Baskets>
  280.      */
  281.     public function getBaskets(): Collection
  282.     {
  283.         return $this->baskets;
  284.     }
  285.     public function addBasket(Baskets $basket): self
  286.     {
  287.         if (!$this->baskets->contains($basket)) {
  288.             $this->baskets[] = $basket;
  289.             $basket->setRetailUser($this);
  290.         }
  291.         return $this;
  292.     }
  293.     public function removeBasket(Baskets $basket): self
  294.     {
  295.         if ($this->baskets->removeElement($basket)) {
  296.             // set the owning side to null (unless already changed)
  297.             if ($basket->getRetailUser() === $this) {
  298.                 $basket->setRetailUser(null);
  299.             }
  300.         }
  301.         return $this;
  302.     }
  303.     /**
  304.      * @return Collection<int, Orders>
  305.      */
  306.     public function getOrders(): Collection
  307.     {
  308.         return $this->orders;
  309.     }
  310.     public function addOrder(Orders $order): self
  311.     {
  312.         if (!$this->orders->contains($order)) {
  313.             $this->orders[] = $order;
  314.             $order->setRetail($this);
  315.         }
  316.         return $this;
  317.     }
  318.     public function removeOrder(Orders $order): self
  319.     {
  320.         if ($this->orders->removeElement($order)) {
  321.             // set the owning side to null (unless already changed)
  322.             if ($order->getRetail() === $this) {
  323.                 $order->setRetail(null);
  324.             }
  325.         }
  326.         return $this;
  327.     }
  328.     public function getClinicId(): ?int
  329.     {
  330.         return $this->clinicId;
  331.     }
  332.     public function setClinicId(?int $clinicId): self
  333.     {
  334.         $this->clinicId $clinicId;
  335.         return $this;
  336.     }
  337. }