From 1f82c8006fb94721be1bbad37e84c75266440b71 Mon Sep 17 00:00:00 2001 From: Ryan Prather Date: Sun, 8 Dec 2024 17:07:16 -0500 Subject: [PATCH] Add Member, MemberCase, and UserCase and associated repositories --- src/Entity/Member.php | 449 ++++++++++++++++++++++++ src/Entity/MemberCase.php | 360 +++++++++++++++++++ src/Entity/UserCase.php | 52 +++ src/Repository/MemberCaseRepository.php | 53 +++ src/Repository/MemberRepository.php | 55 +++ src/Repository/UserCaseRepository.php | 43 +++ 6 files changed, 1012 insertions(+) create mode 100644 src/Entity/Member.php create mode 100644 src/Entity/MemberCase.php create mode 100644 src/Entity/UserCase.php create mode 100644 src/Repository/MemberCaseRepository.php create mode 100644 src/Repository/MemberRepository.php create mode 100644 src/Repository/UserCaseRepository.php diff --git a/src/Entity/Member.php b/src/Entity/Member.php new file mode 100644 index 0000000..7afe290 --- /dev/null +++ b/src/Entity/Member.php @@ -0,0 +1,449 @@ +id; + } + + public function getCaseId(): ?MemberCase + { + return $this->caseId; + } + + public function setCaseId(?MemberCase $caseId): static + { + $this->caseId = $caseId; + + return $this; + } + + public function getLastName(): ?string + { + return $this->lastName; + } + + public function setLastName(string $lastName): static + { + $this->lastName = $lastName; + + return $this; + } + + public function getFirstName(): ?string + { + return $this->firstName; + } + + public function setFirstName(string $firstName): static + { + $this->firstName = $firstName; + + return $this; + } + + public function getRelationship(): ?RelationshipType + { + return $this->relationship; + } + + public function setRelationship(?RelationshipType $relationship): static + { + $this->relationship = $relationship; + + return $this; + } + + public function getPersonalId(): ?string + { + return $this->personalId; + } + + public function setPersonalId(?string $personalId): static + { + $this->personalId = $personalId; + + return $this; + } + + public function getGender(): ?GenderType + { + return $this->gender; + } + + public function setGender(?GenderType $gender): static + { + $this->gender = $gender; + + return $this; + } + + public function getRace(): ?RaceType + { + return $this->race; + } + + public function setRace(?RaceType $race): static + { + $this->race = $race; + + return $this; + } + + public function getDob(): ?\DateTimeInterface + { + return $this->dob; + } + + public function setDob(\DateTimeInterface $dob): static + { + $this->dob = $dob; + + return $this; + } + + public function getLanguage(): ?string + { + return $this->language; + } + + public function setLanguage(?string $language): static + { + $this->language = $language; + + return $this; + } + + public function getEmergencyContact(): ?string + { + return $this->emergencyContact; + } + + public function setEmergencyContact(?string $emergencyContact): static + { + $this->emergencyContact = $emergencyContact; + + return $this; + } + + public function getFormattedPhone(): ?string + { + if ($this->phone) { + return '(' . substr($this->phone, 0, 3) . ') ' . substr($this->phone, 3, 3) . '-' . substr($this->phone, 6); + } elseif ($this->dayPhone) { + return '(' . substr($this->dayPhone, 0, 3) . ') ' . substr($this->dayPhone, 3, 3) . '-' . substr($this->dayPhone, 6); + } elseif ($this->eveningPhone) { + return '(' . substr($this->eveningPhone, 0, 3) . ') ' . substr($this->eveningPhone, 3, 3) . '-' . substr($this->eveningPhone, 6); + } elseif ($this->cellPhone) { + return '(' . substr($this->cellPhone, 0, 3) . ') ' . substr($this->cellPhone, 3, 3) . '-' . substr($this->cellPhone, 6); + } + + return null; + } + + public function getPhone(): ?string + { + return $this->phone; + } + + public function setPhone(?string $phone): static + { + $this->phone = $phone; + + return $this; + } + + public function getDayPhone(): ?string + { + return $this->dayPhone; + } + + public function setDayPhone(?string $dayPhone): static + { + $this->dayPhone = $dayPhone; + + return $this; + } + + public function getEveningPhone(): ?string + { + return $this->eveningPhone; + } + + public function setEveningPhone(?string $eveningPhone): static + { + $this->eveningPhone = $eveningPhone; + + return $this; + } + + public function getCellPhone(): ?string + { + return $this->cellPhone; + } + + public function setCellPhone(?string $cellPhone): static + { + $this->cellPhone = $cellPhone; + + return $this; + } + + public function getEmail(): ?string + { + return $this->email; + } + + public function setEmail(?string $email): static + { + $this->email = $email; + + return $this; + } + + public function getSchool(): ?string + { + return $this->school; + } + + public function setSchool(?string $school): static + { + $this->school = $school; + + return $this; + } + + public function getAddress(): ?string + { + return $this->address; + } + + public function setAddress(?string $address): static + { + $this->address = $address; + + return $this; + } + + public function getCity(): ?string + { + return $this->city; + } + + public function setCity(?string $city): static + { + $this->city = $city; + + return $this; + } + + public function getState(): ?string + { + return $this->state; + } + + public function setState(?string $state): static + { + $this->state = $state; + + return $this; + } + + public function getZip(): ?string + { + return $this->zip; + } + + public function setZip(?string $zip): static + { + $this->zip = $zip; + + return $this; + } + + public function getMaritalStatus(): ?string + { + return $this->maritalStatus; + } + + public function setMaritalStatus(?string $maritalStatus): static + { + $this->maritalStatus = $maritalStatus; + + return $this; + } + + public function isChild(): ?bool + { + return $this->isChild; + } + + public function setChild(bool $isChild): static + { + $this->isChild = $isChild; + + return $this; + } + + public function isParent(): ?bool + { + return $this->isParent; + } + + public function setParent(bool $isParent): static + { + $this->isParent = $isParent; + + return $this; + } + + public function isAdultChild(): ?bool + { + return $this->isAdultChild; + } + + public function setAdultChild(bool $isAdultChild): static + { + $this->isAdultChild = $isAdultChild; + + return $this; + } + + public function isLegalGuardian(): ?bool + { + return $this->isLegalGuardian; + } + + public function setLegalGuardian(bool $isLegalGuardian): static + { + $this->isLegalGuardian = $isLegalGuardian; + + return $this; + } + + public function isParentsLiveTogether(): ?bool + { + return $this->parentsLiveTogether; + } + + public function setParentsLiveTogether(bool $parentsLiveTogether): static + { + $this->parentsLiveTogether = $parentsLiveTogether; + + return $this; + } + + public function isDcsApproved(): ?bool + { + return $this->dcsApproved; + } + + public function setDcsApproved(bool $dcsApproved): static + { + $this->dcsApproved = $dcsApproved; + + return $this; + } +} diff --git a/src/Entity/MemberCase.php b/src/Entity/MemberCase.php new file mode 100644 index 0000000..4b1870e --- /dev/null +++ b/src/Entity/MemberCase.php @@ -0,0 +1,360 @@ + + */ + #[ORM\OneToMany(targetEntity: UserCase::class, mappedBy: 'memberCase')] + private Collection $userCases; + + public function __construct() + { + $this->userCases = new ArrayCollection(); + } + + public function getId(): ?Uuid + { + return $this->id; + } + + public function getCaseNumber(): ?string + { + return $this->caseNumber; + } + + public function setCaseNumber(string $caseNumber): static + { + $this->caseNumber = $caseNumber; + + return $this; + } + + public function getFirstName(): ?string + { + return $this->firstName; + } + + public function setFirstName(string $firstName): static + { + $this->firstName = $firstName; + + return $this; + } + + public function getLastName(): ?string + { + return $this->lastName; + } + + public function setLastName(string $lastName): static + { + $this->lastName = $lastName; + + return $this; + } + + public function getCaseName(): string + { + return "{$this->lastName}, {$this->firstName}"; + } + + public function getReferralType(): ?string + { + return $this->referralType; + } + + public function setReferralType(string $referralType): static + { + $this->referralType = $referralType; + + return $this; + } + + public function getReferralSource(): ?ReferralSource + { + return $this->referralSource; + } + + public function setReferralSource(?ReferralSource $referralSource): static + { + $this->referralSource = $referralSource; + + return $this; + } + + public function getReferralSource2(): ?ReferralSource + { + return $this->referralSource2; + } + + public function setReferralSource2(?ReferralSource $referralSource2): static + { + $this->referralSource2 = $referralSource2; + + return $this; + } + + public function getAdmitDate(): ?\DateTimeInterface + { + return $this->admitDate; + } + + public function setAdmitDate(?\DateTimeInterface $admitDate): static + { + $this->admitDate = $admitDate; + + return $this; + } + + public function getCloseDate(): ?\DateTimeInterface + { + return $this->closeDate; + } + + public function setCloseDate(?\DateTimeInterface $closeDate): static + { + $this->closeDate = $closeDate; + + return $this; + } + + public function getDcsCaseId(): ?int + { + return $this->dcsCaseId; + } + + public function setDcsCaseId(?int $dcsCaseId): static + { + $this->dcsCaseId = $dcsCaseId; + + return $this; + } + + public function getInsurance(): ?string + { + return $this->insurance; + } + + public function setInsurance(?string $insurance): static + { + $this->insurance = $insurance; + + return $this; + } + + public function getMedicaid(): ?string + { + return $this->medicaid; + } + + public function setMedicaid(?string $medicaid): static + { + $this->medicaid = $medicaid; + + return $this; + } + + public function getCaseEmail(): ?string + { + return $this->caseEmail; + } + + public function setCaseEmail(?string $caseEmail): static + { + $this->caseEmail = $caseEmail; + + return $this; + } + + public function getAddress(): ?string + { + return $this->address; + } + + public function setAddress(?string $address): static + { + $this->address = $address; + + return $this; + } + + public function getCounty(): ?County + { + return $this->county; + } + + public function setCounty(County $county): static + { + $this->county = $county; + + return $this; + } + + public function getLevel(): ?CaseLevel + { + return $this->level; + } + + public function setLevel(CaseLevel $level): static + { + $this->level = $level; + + return $this; + } + + public function getAddress2(): ?string + { + return $this->address2; + } + + public function setAddress2(?string $address2): static + { + $this->address2 = $address2; + + return $this; + } + + public function getCity(): ?string + { + return $this->city; + } + + public function setCity(?string $city): static + { + $this->city = $city; + + return $this; + } + + public function getState(): ?string + { + return $this->state; + } + + public function setState(?string $state): static + { + $this->state = $state; + + return $this; + } + + public function getZip(): ?int + { + return $this->zip; + } + + public function setZip(?int $zip): static + { + $this->zip = $zip; + + return $this; + } + + /** + * @return Collection + */ + public function getUserCases(): Collection + { + return $this->userCases; + } + + public function addUserCase(UserCase $userCase): static + { + if (!$this->userCases->contains($userCase)) { + $this->userCases->add($userCase); + $userCase->setMemberCase($this); + } + + return $this; + } + + public function removeUserCase(UserCase $userCase): static + { + if ($this->userCases->removeElement($userCase)) { + // set the owning side to null (unless already changed) + if ($userCase->getMemberCase() === $this) { + $userCase->setMemberCase(null); + } + } + + return $this; + } +} diff --git a/src/Entity/UserCase.php b/src/Entity/UserCase.php new file mode 100644 index 0000000..fca3f60 --- /dev/null +++ b/src/Entity/UserCase.php @@ -0,0 +1,52 @@ +id; + } + + public function getUser(): ?User + { + return $this->user; + } + + public function setUser(?User $user): static + { + $this->user = $user; + + return $this; + } + + public function getMemberCase(): ?MemberCase + { + return $this->memberCase; + } + + public function setMemberCase(?MemberCase $memberCase): static + { + $this->memberCase = $memberCase; + + return $this; + } +} diff --git a/src/Repository/MemberCaseRepository.php b/src/Repository/MemberCaseRepository.php new file mode 100644 index 0000000..e2d7fcc --- /dev/null +++ b/src/Repository/MemberCaseRepository.php @@ -0,0 +1,53 @@ + + */ +class MemberCaseRepository extends ServiceEntityRepository +{ + public function __construct(ManagerRegistry $registry) + { + parent::__construct($registry, MemberCase::class); + } + + public function getCompanyCases(Company $company): array + { + return $this->createQueryBuilder('m') + ->andWhere('m.company = :company') + ->setParameter('company', $company) + ->getQuery() + ->getResult(); + } + + // /** + // * @return MemberCase[] Returns an array of MemberCase objects + // */ + // public function findByExampleField($value): array + // { + // return $this->createQueryBuilder('m') + // ->andWhere('m.exampleField = :val') + // ->setParameter('val', $value) + // ->orderBy('m.id', 'ASC') + // ->setMaxResults(10) + // ->getQuery() + // ->getResult() + // ; + // } + + // public function findOneBySomeField($value): ?MemberCase + // { + // return $this->createQueryBuilder('m') + // ->andWhere('m.exampleField = :val') + // ->setParameter('val', $value) + // ->getQuery() + // ->getOneOrNullResult() + // ; + // } +} diff --git a/src/Repository/MemberRepository.php b/src/Repository/MemberRepository.php new file mode 100644 index 0000000..b37f078 --- /dev/null +++ b/src/Repository/MemberRepository.php @@ -0,0 +1,55 @@ + + */ +class MemberRepository extends ServiceEntityRepository +{ + public function __construct(ManagerRegistry $registry) + { + parent::__construct($registry, Member::class); + } + + public function getCaseMembersByName(MemberCase $case): array + { + return $this->createQueryBuilder('m') + ->andWhere('m.caseId = :case') + ->setParameter('case', $case->getId()->toBinary()) + ->orderBy('m.lastName, m.firstName', 'ASC') + ->getQuery() + ->getResult() + ; + } + + // /** + // * @return Member[] Returns an array of Member objects + // */ + // public function findByExampleField($value): array + // { + // return $this->createQueryBuilder('m') + // ->andWhere('m.exampleField = :val') + // ->setParameter('val', $value) + // ->orderBy('m.id', 'ASC') + // ->setMaxResults(10) + // ->getQuery() + // ->getResult() + // ; + // } + + // public function findOneBySomeField($value): ?Member + // { + // return $this->createQueryBuilder('m') + // ->andWhere('m.exampleField = :val') + // ->setParameter('val', $value) + // ->getQuery() + // ->getOneOrNullResult() + // ; + // } +} diff --git a/src/Repository/UserCaseRepository.php b/src/Repository/UserCaseRepository.php new file mode 100644 index 0000000..c45bc52 --- /dev/null +++ b/src/Repository/UserCaseRepository.php @@ -0,0 +1,43 @@ + + */ +class UserCaseRepository extends ServiceEntityRepository +{ + public function __construct(ManagerRegistry $registry) + { + parent::__construct($registry, UserCase::class); + } + +// /** +// * @return UserCase[] Returns an array of UserCase objects +// */ +// public function findByExampleField($value): array +// { +// return $this->createQueryBuilder('u') +// ->andWhere('u.exampleField = :val') +// ->setParameter('val', $value) +// ->orderBy('u.id', 'ASC') +// ->setMaxResults(10) +// ->getQuery() +// ->getResult() +// ; +// } + +// public function findOneBySomeField($value): ?UserCase +// { +// return $this->createQueryBuilder('u') +// ->andWhere('u.exampleField = :val') +// ->setParameter('val', $value) +// ->getQuery() +// ->getOneOrNullResult() +// ; +// } +}