src/Entity/ClinicUsers.php line 13

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\ClinicUsersRepository;
  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(repositoryClassClinicUsersRepository::class)]
  10. class ClinicUsers implements UserInterfacePasswordAuthenticatedUserInterface
  11. {
  12.     #[ORM\Id]
  13.     #[ORM\GeneratedValue]
  14.     #[ORM\Column(type'integer')]
  15.     private $id;
  16.     #[ORM\ManyToOne(targetEntityClinics::class, inversedBy'clinicUsers')]
  17.     private $clinic;
  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\OneToMany(targetEntityProductNotes::class, mappedBy'clinicUser')]
  38.     private $productNotes;
  39.     #[ORM\OneToMany(targetEntityProductReviews::class, mappedBy'clinicUser')]
  40.     private $productReviews;
  41.     #[ORM\Column(type'boolean')]
  42.     private $isPrimary;
  43.     #[ORM\Column(type'string'length255)]
  44.     private $telephone;
  45.     #[ORM\OneToMany(targetEntityProductReviewLikes::class, mappedBy'clinicUser')]
  46.     private $productReviewLikes;
  47.     #[ORM\OneToMany(targetEntityProductReviewComments::class, mappedBy'clinicUser')]
  48.     private $productReviewComments;
  49.     #[ORM\Column(type'string'length255nullabletrue)]
  50.     private $isoCode;
  51.     #[ORM\Column(type'string'length255nullabletrue)]
  52.     private $intlCode;
  53.     #[ORM\Column(type'string'length255nullabletrue)]
  54.     private $resetKey;
  55.     #[ORM\OneToMany(targetEntityClinicUserPermissions::class, mappedBy'user')]
  56.     private $clinicUserPermissions;
  57.     #[ORM\Column(type'string'length255nullabletrue)]
  58.     private $hashedEmail;
  59.     public function __construct()
  60.     {
  61.         $this->setModified(new \DateTime());
  62.         if ($this->getCreated() == null) {
  63.             $this->setCreated(new \DateTime());
  64.         }
  65.         $this->productNotes = new ArrayCollection();
  66.         $this->productReviews = new ArrayCollection();
  67.         $this->productReviewLikes = new ArrayCollection();
  68.         $this->productReviewComments = new ArrayCollection();
  69.         $this->clinicUserPermissions = new ArrayCollection();
  70.     }
  71.     public function getId(): ?int
  72.     {
  73.         return $this->id;
  74.     }
  75.     public function getClinic(): ?Clinics
  76.     {
  77.         return $this->clinic;
  78.     }
  79.     public function setClinic(?Clinics $clinic): self
  80.     {
  81.         $this->clinic $clinic;
  82.         return $this;
  83.     }
  84.     public function getFirstName(): ?string
  85.     {
  86.         return $this->firstName;
  87.     }
  88.     public function setFirstName(string $firstName): self
  89.     {
  90.         $this->firstName $firstName;
  91.         return $this;
  92.     }
  93.     public function getLastName(): ?string
  94.     {
  95.         return $this->lastName;
  96.     }
  97.     public function setLastName(string $lastName): self
  98.     {
  99.         $this->lastName $lastName;
  100.         return $this;
  101.     }
  102.     public function getEmail(): ?string
  103.     {
  104.         return $this->email;
  105.     }
  106.     public function setEmail(string $email): self
  107.     {
  108.         $this->email $email;
  109.         return $this;
  110.     }
  111.     public function getPosition(): ?string
  112.     {
  113.         return $this->position;
  114.     }
  115.     public function setPosition(string $position): self
  116.     {
  117.         $this->position $position;
  118.         return $this;
  119.     }
  120.     public function getModified(): ?\DateTimeInterface
  121.     {
  122.         return $this->modified;
  123.     }
  124.     public function setModified(\DateTimeInterface $modified): self
  125.     {
  126.         $this->modified $modified;
  127.         return $this;
  128.     }
  129.     public function getCreated(): ?\DateTimeInterface
  130.     {
  131.         return $this->created;
  132.     }
  133.     public function setCreated(\DateTimeInterface $created): self
  134.     {
  135.         $this->created $created;
  136.         return $this;
  137.     }
  138.     /**
  139.      * @return Collection|ProductNotes[]
  140.      */
  141.     public function getProductNotes(): Collection
  142.     {
  143.         return $this->productNotes;
  144.     }
  145.     public function addProductNote(ProductNotes $productNote): self
  146.     {
  147.         if (!$this->productNotes->contains($productNote)) {
  148.             $this->productNotes[] = $productNote;
  149.             $productNote->setClinicUser($this);
  150.         }
  151.         return $this;
  152.     }
  153.     public function removeProductNote(ProductNotes $productNote): self
  154.     {
  155.         if ($this->productNotes->removeElement($productNote)) {
  156.             // set the owning side to null (unless already changed)
  157.             if ($productNote->getClinicUser() === $this) {
  158.                 $productNote->setClinicUser(null);
  159.             }
  160.         }
  161.         return $this;
  162.     }
  163.     /**
  164.      * @return Collection|ProductReviews[]
  165.      */
  166.     public function getProductReviews(): Collection
  167.     {
  168.         return $this->productReviews;
  169.     }
  170.     public function addProductReview(ProductReviews $productReview): self
  171.     {
  172.         if (!$this->productReviews->contains($productReview)) {
  173.             $this->productReviews[] = $productReview;
  174.             $productReview->setClinicUser($this);
  175.         }
  176.         return $this;
  177.     }
  178.     public function removeProductReview(ProductReviews $productReview): self
  179.     {
  180.         if ($this->productReviews->removeElement($productReview)) {
  181.             // set the owning side to null (unless already changed)
  182.             if ($productReview->getClinicUser() === $this) {
  183.                 $productReview->setClinicUser(null);
  184.             }
  185.         }
  186.         return $this;
  187.     }
  188.     /**
  189.      * A visual identifier that represents this user.
  190.      *
  191.      * @see UserInterface
  192.      */
  193.     public function getUserIdentifier(): string
  194.     {
  195.         return (string) $this->email;
  196.     }
  197.     /**
  198.      * @deprecated since Symfony 5.3, use getUserIdentifier instead
  199.      */
  200.     public function getUsername(): string
  201.     {
  202.         return (string) $this->email;
  203.     }
  204.     /**
  205.      * @see UserInterface
  206.      */
  207.     public function getRoles(): array
  208.     {
  209.         $roles $this->roles;
  210.         // guarantee every user at least has ROLE_USER
  211.         $roles[] = 'ROLE_USER';
  212.         return array_unique($roles);
  213.     }
  214.     public function setRoles(array $roles): self
  215.     {
  216.         $this->roles $roles;
  217.         return $this;
  218.     }
  219.     /**
  220.      * @see PasswordAuthenticatedUserInterface
  221.      */
  222.     public function getPassword(): string
  223.     {
  224.         return $this->password;
  225.     }
  226.     public function setPassword(string $password): self
  227.     {
  228.         $this->password $password;
  229.         return $this;
  230.     }
  231.     /**
  232.      * Returning a salt is only needed, if you are not using a modern
  233.      * hashing algorithm (e.g. bcrypt or sodium) in your security.yaml.
  234.      *
  235.      * @see UserInterface
  236.      */
  237.     public function getSalt(): ?string
  238.     {
  239.         return null;
  240.     }
  241.     /**
  242.      * @see UserInterface
  243.      */
  244.     public function eraseCredentials()
  245.     {
  246.         // If you inventory any temporary, sensitive data on the user, clear it here
  247.         // $this->plainPassword = null;
  248.     }
  249.     public function __toString(){
  250.         return $this->getFirstName() .' '$this->getLastName();
  251.     }
  252.     public function getIsPrimary(): ?bool
  253.     {
  254.         return $this->isPrimary;
  255.     }
  256.     public function setIsPrimary(bool $isPrimary): self
  257.     {
  258.         $this->isPrimary $isPrimary;
  259.         return $this;
  260.     }
  261.     public function getTelephone(): ?string
  262.     {
  263.         return $this->telephone;
  264.     }
  265.     public function setTelephone(string $telephone): self
  266.     {
  267.         $this->telephone $telephone;
  268.         return $this;
  269.     }
  270.     /**
  271.      * @return Collection<int, ProductReviewLikes>
  272.      */
  273.     public function getProductReviewLikes(): Collection
  274.     {
  275.         return $this->productReviewLikes;
  276.     }
  277.     public function addProductReviewLike(ProductReviewLikes $productReviewLike): self
  278.     {
  279.         if (!$this->productReviewLikes->contains($productReviewLike)) {
  280.             $this->productReviewLikes[] = $productReviewLike;
  281.             $productReviewLike->setClinicUser($this);
  282.         }
  283.         return $this;
  284.     }
  285.     public function removeProductReviewLike(ProductReviewLikes $productReviewLike): self
  286.     {
  287.         if ($this->productReviewLikes->removeElement($productReviewLike)) {
  288.             // set the owning side to null (unless already changed)
  289.             if ($productReviewLike->getClinicUser() === $this) {
  290.                 $productReviewLike->setClinicUser(null);
  291.             }
  292.         }
  293.         return $this;
  294.     }
  295.     /**
  296.      * @return Collection<int, ProductReviewComments>
  297.      */
  298.     public function getProductReviewComments(): Collection
  299.     {
  300.         return $this->productReviewComments;
  301.     }
  302.     public function addProductReviewComment(ProductReviewComments $productReviewComment): self
  303.     {
  304.         if (!$this->productReviewComments->contains($productReviewComment)) {
  305.             $this->productReviewComments[] = $productReviewComment;
  306.             $productReviewComment->setClinicUser($this);
  307.         }
  308.         return $this;
  309.     }
  310.     public function removeProductReviewComment(ProductReviewComments $productReviewComment): self
  311.     {
  312.         if ($this->productReviewComments->removeElement($productReviewComment)) {
  313.             // set the owning side to null (unless already changed)
  314.             if ($productReviewComment->getClinicUser() === $this) {
  315.                 $productReviewComment->setClinicUser(null);
  316.             }
  317.         }
  318.         return $this;
  319.     }
  320.     public function getIsoCode(): ?string
  321.     {
  322.         return $this->isoCode;
  323.     }
  324.     public function setIsoCode(?string $isoCode): self
  325.     {
  326.         $this->isoCode $isoCode;
  327.         return $this;
  328.     }
  329.     public function getIntlCode(): ?string
  330.     {
  331.         return $this->intlCode;
  332.     }
  333.     public function setIntlCode(?string $intlCode): self
  334.     {
  335.         $this->intlCode $intlCode;
  336.         return $this;
  337.     }
  338.     public function getResetKey(): ?string
  339.     {
  340.         return $this->resetKey;
  341.     }
  342.     public function setResetKey(?string $resetKey): self
  343.     {
  344.         $this->resetKey $resetKey;
  345.         return $this;
  346.     }
  347.     /**
  348.      * @return Collection<int, ClinicUserPermissions>
  349.      */
  350.     public function getClinicUserPermissions(): Collection
  351.     {
  352.         return $this->clinicUserPermissions;
  353.     }
  354.     public function addClinicUserPermission(ClinicUserPermissions $clinicUserPermission): self
  355.     {
  356.         if (!$this->clinicUserPermissions->contains($clinicUserPermission)) {
  357.             $this->clinicUserPermissions[] = $clinicUserPermission;
  358.             $clinicUserPermission->setUser($this);
  359.         }
  360.         return $this;
  361.     }
  362.     public function removeClinicUserPermission(ClinicUserPermissions $clinicUserPermission): self
  363.     {
  364.         if ($this->clinicUserPermissions->removeElement($clinicUserPermission)) {
  365.             // set the owning side to null (unless already changed)
  366.             if ($clinicUserPermission->getUser() === $this) {
  367.                 $clinicUserPermission->setUser(null);
  368.             }
  369.         }
  370.         return $this;
  371.     }
  372.     public function getHashedEmail(): ?string
  373.     {
  374.         return $this->hashedEmail;
  375.     }
  376.     public function setHashedEmail(?string $hashedEmail): self
  377.     {
  378.         $this->hashedEmail $hashedEmail;
  379.         return $this;
  380.     }
  381. }