diff --git a/src/Entity/User.php b/src/Entity/User.php index 04ff35c..91bcf23 100644 --- a/src/Entity/User.php +++ b/src/Entity/User.php @@ -4,10 +4,9 @@ namespace App\Entity; use App\Repository\UserRepository; use App\Enums\RateType; -use App\Enums\JobType; +use App\Enums\CaseLevel; use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\Collection; - use Doctrine\DBAL\Types\Types; use Doctrine\ORM\Mapping as ORM; use Symfony\Bridge\Doctrine\Types\UuidType; @@ -15,7 +14,6 @@ use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity; use Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface; use Symfony\Component\Security\Core\User\UserInterface; use Symfony\Component\Uid\Uuid; -use \App\Enums\CaseLevel; #[ORM\Entity(repositoryClass: UserRepository::class)] #[ORM\UniqueConstraint(name: 'UNIQ_IDENTIFIER_USERNAME', fields: ['username'])] @@ -49,9 +47,6 @@ class User implements UserInterface, PasswordAuthenticatedUserInterface #[ORM\Column(length: 45)] private ?string $email = null; - #[ORM\Column(length: 45)] - private ?JobType $job = null; - #[ORM\Column(enumType: RateType::class)] private ?RateType $rateType = null; @@ -73,6 +68,18 @@ class User implements UserInterface, PasswordAuthenticatedUserInterface private ?User $supervisor = null; + #[ORM\Column] + private ?bool $caseWorker = null; + + #[ORM\Column] + private ?bool $caseManager = null; + + #[ORM\Column] + private ?bool $therapist = null; + + #[ORM\Column] + private ?bool $su = null; + public function __construct() { $this->userCases = new ArrayCollection(); @@ -177,18 +184,6 @@ class User implements UserInterface, PasswordAuthenticatedUserInterface return $this; } - public function getJob(): ?JobType - { - return $this->job; - } - - public function setJob(JobType $job): static - { - $this->job = $job; - - return $this; - } - public function getRateType(): ?RateType { return $this->rateType; @@ -308,4 +303,74 @@ class User implements UserInterface, PasswordAuthenticatedUserInterface return $this; } + + public function isCaseWorker(): ?bool + { + return $this->caseWorker; + } + + public function setCaseWorker(bool $caseWorker): static + { + $this->caseWorker = $caseWorker; + + return $this; + } + + public function isCaseManager(): ?bool + { + return $this->caseManager; + } + + public function setCaseManager(bool $caseManager): static + { + $this->caseManager = $caseManager; + + return $this; + } + + public function isTherapist(): ?bool + { + return $this->therapist; + } + + public function setTherapist(bool $therapist): static + { + $this->therapist = $therapist; + + return $this; + } + + public function isSu(): ?bool + { + return $this->su; + } + + public function setSu(bool $su): static + { + $this->su = $su; + + return $this; + } + + public function getJobs(): array + { + $jobs = []; + if ($this->caseWorker) { + $jobs[] = 'Case Worker'; + } + + if ($this->caseManager) { + $jobs[] = 'Case Manager'; + } + + if ($this->therapist) { + $jobs[] = 'Therapist'; + } + + if ($this->su) { + $jobs[] = 'Admin'; + } + + return $jobs; + } }