Add Member, MemberCase, and UserCase and associated repositories
This commit is contained in:
parent
49c033f3b8
commit
1f82c8006f
449
src/Entity/Member.php
Normal file
449
src/Entity/Member.php
Normal file
@ -0,0 +1,449 @@
|
||||
<?php
|
||||
|
||||
namespace App\Entity;
|
||||
|
||||
use App\Enums\GenderType;
|
||||
use App\Enums\RaceType;
|
||||
use App\Enums\RelationshipType;
|
||||
use App\Repository\MemberRepository;
|
||||
use Doctrine\DBAL\Types\Types;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
use Symfony\Bridge\Doctrine\Types\UuidType;
|
||||
use Symfony\Component\Uid\Uuid;
|
||||
|
||||
#[ORM\Entity(repositoryClass: MemberRepository::class)]
|
||||
#[ORM\Table(name: '`member`')]
|
||||
class Member
|
||||
{
|
||||
#[ORM\Id]
|
||||
#[ORM\Column(type: UuidType::NAME, unique: true)]
|
||||
#[ORM\GeneratedValue(strategy: 'CUSTOM')]
|
||||
#[ORM\CustomIdGenerator(class: 'doctrine.uuid_generator')]
|
||||
private ?Uuid $id = null;
|
||||
|
||||
#[ORM\ManyToOne(inversedBy: 'members')]
|
||||
#[ORM\JoinColumn(nullable: false)]
|
||||
private ?MemberCase $caseId = null;
|
||||
|
||||
#[ORM\Column(length: 45)]
|
||||
private ?string $lastName = null;
|
||||
|
||||
#[ORM\Column(length: 45)]
|
||||
private ?string $firstName = null;
|
||||
|
||||
#[ORM\Column(length: 45, nullable: true)]
|
||||
private ?RelationshipType $relationship = null;
|
||||
|
||||
#[ORM\Column(length: 45, nullable: true)]
|
||||
private ?string $personalId = null;
|
||||
|
||||
#[ORM\Column(nullable: true, enumType: GenderType::class)]
|
||||
private ?GenderType $gender = null;
|
||||
|
||||
#[ORM\Column(length: 45, nullable: true)]
|
||||
private ?RaceType $race = null;
|
||||
|
||||
#[ORM\Column(type: Types::DATE_MUTABLE)]
|
||||
private ?\DateTimeInterface $dob = null;
|
||||
|
||||
#[ORM\Column(length: 45, nullable: true)]
|
||||
private ?string $language = null;
|
||||
|
||||
#[ORM\Column(length: 45, nullable: true)]
|
||||
private ?string $emergencyContact = null;
|
||||
|
||||
#[ORM\Column(length: 15, nullable: true)]
|
||||
private ?string $phone = null;
|
||||
|
||||
#[ORM\Column(length: 15, nullable: true)]
|
||||
private ?string $dayPhone = null;
|
||||
|
||||
#[ORM\Column(length: 15, nullable: true)]
|
||||
private ?string $eveningPhone = null;
|
||||
|
||||
#[ORM\Column(length: 15, nullable: true)]
|
||||
private ?string $cellPhone = null;
|
||||
|
||||
#[ORM\Column(length: 45, nullable: true)]
|
||||
private ?string $email = null;
|
||||
|
||||
#[ORM\Column(length: 255, nullable: true)]
|
||||
private ?string $school = null;
|
||||
|
||||
#[ORM\Column(length: 64, nullable: true)]
|
||||
private ?string $address = null;
|
||||
|
||||
#[ORM\Column(length: 45, nullable: true)]
|
||||
private ?string $city = null;
|
||||
|
||||
#[ORM\Column(length: 15, nullable: true)]
|
||||
private ?string $state = null;
|
||||
|
||||
#[ORM\Column(length: 10, nullable: true)]
|
||||
private ?string $zip = null;
|
||||
|
||||
#[ORM\Column(length: 45, nullable: true)]
|
||||
private ?string $maritalStatus = null;
|
||||
|
||||
#[ORM\Column]
|
||||
private ?bool $isChild = null;
|
||||
|
||||
#[ORM\Column]
|
||||
private ?bool $isParent = null;
|
||||
|
||||
#[ORM\Column]
|
||||
private ?bool $isAdultChild = null;
|
||||
|
||||
#[ORM\Column]
|
||||
private ?bool $isLegalGuardian = null;
|
||||
|
||||
#[ORM\Column]
|
||||
private ?bool $parentsLiveTogether = null;
|
||||
|
||||
#[ORM\Column]
|
||||
private ?bool $dcsApproved = null;
|
||||
|
||||
public function getId(): ?Uuid
|
||||
{
|
||||
return $this->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;
|
||||
}
|
||||
}
|
360
src/Entity/MemberCase.php
Normal file
360
src/Entity/MemberCase.php
Normal file
@ -0,0 +1,360 @@
|
||||
<?php
|
||||
|
||||
namespace App\Entity;
|
||||
|
||||
use App\Enums\CaseLevel;
|
||||
use App\Enums\County;
|
||||
use App\Repository\MemberCaseRepository;
|
||||
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;
|
||||
use Symfony\Component\Uid\Uuid;
|
||||
|
||||
#[ORM\Entity(repositoryClass: MemberCaseRepository::class)]
|
||||
class MemberCase
|
||||
{
|
||||
#[ORM\Id]
|
||||
#[ORM\Column(type: UuidType::NAME, unique: true)]
|
||||
#[ORM\GeneratedValue(strategy: 'CUSTOM')]
|
||||
#[ORM\CustomIdGenerator(class: 'doctrine.uuid_generator')]
|
||||
private ?Uuid $id = null;
|
||||
|
||||
#[ORM\Column(length: 15)]
|
||||
private ?string $caseNumber = null;
|
||||
|
||||
#[ORM\Column(length: 45)]
|
||||
private ?string $firstName = null;
|
||||
|
||||
#[ORM\Column(length: 45)]
|
||||
private ?string $lastName = null;
|
||||
|
||||
#[ORM\Column(length: 45)]
|
||||
private ?string $referralType = null;
|
||||
|
||||
#[ORM\ManyToOne]
|
||||
#[ORM\JoinColumn(nullable: false)]
|
||||
private ?ReferralSource $referralSource = null;
|
||||
|
||||
#[ORM\ManyToOne]
|
||||
private ?ReferralSource $referralSource2 = null;
|
||||
|
||||
#[ORM\Column(type: Types::DATE_MUTABLE, nullable: true)]
|
||||
private ?\DateTimeInterface $admitDate = null;
|
||||
|
||||
#[ORM\Column(type: Types::DATE_MUTABLE, nullable: true)]
|
||||
private ?\DateTimeInterface $closeDate = null;
|
||||
|
||||
#[ORM\Column(length: 15, nullable: true)]
|
||||
private ?string $dcsCaseId = null;
|
||||
|
||||
#[ORM\Column(length: 45, nullable: true)]
|
||||
private ?string $insurance = null;
|
||||
|
||||
#[ORM\Column(length: 45, nullable: true)]
|
||||
private ?string $medicaid = null;
|
||||
|
||||
#[ORM\Column(length: 64, nullable: true)]
|
||||
private ?string $caseEmail = null;
|
||||
|
||||
#[ORM\Column(length: 255, nullable: true)]
|
||||
private ?string $address = null;
|
||||
|
||||
#[ORM\Column(length: 255, nullable: true)]
|
||||
private ?string $address2 = null;
|
||||
|
||||
#[ORM\Column(length: 255, nullable: true)]
|
||||
private ?string $city = null;
|
||||
|
||||
#[ORM\Column(length: 10, nullable: true)]
|
||||
private ?string $state = null;
|
||||
|
||||
#[ORM\Column(nullable: true)]
|
||||
private ?int $zip = null;
|
||||
|
||||
#[ORM\Column(enumType: County::class)]
|
||||
private ?County $county = null;
|
||||
|
||||
#[ORM\Column(enumType: CaseLevel::class)]
|
||||
private ?CaseLevel $level = null;
|
||||
|
||||
/**
|
||||
* @var Collection<int, UserCase>
|
||||
*/
|
||||
#[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<int, UserCase>
|
||||
*/
|
||||
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;
|
||||
}
|
||||
}
|
52
src/Entity/UserCase.php
Normal file
52
src/Entity/UserCase.php
Normal file
@ -0,0 +1,52 @@
|
||||
<?php
|
||||
|
||||
namespace App\Entity;
|
||||
|
||||
use App\Repository\UserCaseRepository;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
#[ORM\Entity(repositoryClass: UserCaseRepository::class)]
|
||||
class UserCase
|
||||
{
|
||||
#[ORM\Id]
|
||||
#[ORM\GeneratedValue]
|
||||
#[ORM\Column]
|
||||
private ?int $id = null;
|
||||
|
||||
#[ORM\ManyToOne(inversedBy: 'userCases')]
|
||||
#[ORM\JoinColumn(nullable: false)]
|
||||
private ?User $user = null;
|
||||
|
||||
#[ORM\ManyToOne(inversedBy: 'userCases')]
|
||||
#[ORM\JoinColumn(nullable: false)]
|
||||
private ?MemberCase $memberCase = null;
|
||||
|
||||
public function getId(): ?int
|
||||
{
|
||||
return $this->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;
|
||||
}
|
||||
}
|
53
src/Repository/MemberCaseRepository.php
Normal file
53
src/Repository/MemberCaseRepository.php
Normal file
@ -0,0 +1,53 @@
|
||||
<?php
|
||||
|
||||
namespace App\Repository;
|
||||
|
||||
use App\Entity\Company;
|
||||
use App\Entity\MemberCase;
|
||||
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
|
||||
use Doctrine\Persistence\ManagerRegistry;
|
||||
|
||||
/**
|
||||
* @extends ServiceEntityRepository<MemberCase>
|
||||
*/
|
||||
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()
|
||||
// ;
|
||||
// }
|
||||
}
|
55
src/Repository/MemberRepository.php
Normal file
55
src/Repository/MemberRepository.php
Normal file
@ -0,0 +1,55 @@
|
||||
<?php
|
||||
|
||||
namespace App\Repository;
|
||||
|
||||
use App\Entity\Member;
|
||||
use App\Entity\MemberCase;
|
||||
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
|
||||
use Doctrine\Persistence\ManagerRegistry;
|
||||
|
||||
/**
|
||||
* @extends ServiceEntityRepository<Member>
|
||||
*/
|
||||
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()
|
||||
// ;
|
||||
// }
|
||||
}
|
43
src/Repository/UserCaseRepository.php
Normal file
43
src/Repository/UserCaseRepository.php
Normal file
@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
namespace App\Repository;
|
||||
|
||||
use App\Entity\UserCase;
|
||||
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
|
||||
use Doctrine\Persistence\ManagerRegistry;
|
||||
|
||||
/**
|
||||
* @extends ServiceEntityRepository<UserCase>
|
||||
*/
|
||||
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()
|
||||
// ;
|
||||
// }
|
||||
}
|
Loading…
Reference in New Issue
Block a user