diff --git a/src/Entity/MemberCase.php b/src/Entity/MemberCase.php index 61f00da..5e2d311 100644 --- a/src/Entity/MemberCase.php +++ b/src/Entity/MemberCase.php @@ -4,6 +4,7 @@ namespace App\Entity; use App\Enums\CaseLevel; use App\Enums\County; +use App\Enums\Case\ReferralType; use App\Repository\MemberCaseRepository; use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\Collection; @@ -31,7 +32,7 @@ class MemberCase private ?string $lastName = null; #[ORM\Column(length: 45)] - private ?string $referralType = null; + private ?ReferralType $referralType = null; #[ORM\ManyToOne] #[ORM\JoinColumn(nullable: false)] @@ -109,8 +110,6 @@ class MemberCase #[ORM\OneToMany(targetEntity: StaffNote::class, mappedBy: 'memberCase')] private Collection $staffNotes; - private array $docs; - public function __construct() { $this->userCases = new ArrayCollection(); @@ -166,12 +165,12 @@ class MemberCase return "{$this->lastName}, {$this->firstName}"; } - public function getReferralType(): ?string + public function getReferralType(): ?ReferralType { return $this->referralType; } - public function setReferralType(string $referralType): static + public function setReferralType(ReferralType $referralType): static { $this->referralType = $referralType; @@ -507,9 +506,4 @@ class MemberCase return $this; } - - public function getDocs(): array - { - return $this->docs; - } } diff --git a/src/Enums/Case/ReferralType.php b/src/Enums/Case/ReferralType.php new file mode 100644 index 0000000..c65cb3d --- /dev/null +++ b/src/Enums/Case/ReferralType.php @@ -0,0 +1,9 @@ +add('lastName', null, ['required' => true]) ->add('firstName', null, ['required' => true]) @@ -68,6 +71,14 @@ class MemberFormType extends AbstractType ->add('dcsApproved', CheckboxType::class, [ 'mapped' => false ]) + ->add('docs', EntityType::class, [ + 'class' => CompanyDocument::class, + 'choices' => $docs, + 'multiple' => true, + 'expanded' => true, + 'choice_label' => 'title', + 'mapped' => false, + ]) ; } @@ -75,6 +86,7 @@ class MemberFormType extends AbstractType { $resolver->setDefaults([ 'data_class' => Member::class, + 'docs' => [], 'csrf_protection' => true, 'csrf_field_name' => '_token', 'csrf_token_id' => 'member',