fix: MemberCase
ReferralType * Convert ReferralType in class to an Enum
This commit is contained in:
parent
82ee30a724
commit
6d8fbd5bb8
@ -4,6 +4,7 @@ namespace App\Entity;
|
|||||||
|
|
||||||
use App\Enums\CaseLevel;
|
use App\Enums\CaseLevel;
|
||||||
use App\Enums\County;
|
use App\Enums\County;
|
||||||
|
use App\Enums\Case\ReferralType;
|
||||||
use App\Repository\MemberCaseRepository;
|
use App\Repository\MemberCaseRepository;
|
||||||
use Doctrine\Common\Collections\ArrayCollection;
|
use Doctrine\Common\Collections\ArrayCollection;
|
||||||
use Doctrine\Common\Collections\Collection;
|
use Doctrine\Common\Collections\Collection;
|
||||||
@ -31,7 +32,7 @@ class MemberCase
|
|||||||
private ?string $lastName = null;
|
private ?string $lastName = null;
|
||||||
|
|
||||||
#[ORM\Column(length: 45)]
|
#[ORM\Column(length: 45)]
|
||||||
private ?string $referralType = null;
|
private ?ReferralType $referralType = null;
|
||||||
|
|
||||||
#[ORM\ManyToOne]
|
#[ORM\ManyToOne]
|
||||||
#[ORM\JoinColumn(nullable: false)]
|
#[ORM\JoinColumn(nullable: false)]
|
||||||
@ -109,8 +110,6 @@ class MemberCase
|
|||||||
#[ORM\OneToMany(targetEntity: StaffNote::class, mappedBy: 'memberCase')]
|
#[ORM\OneToMany(targetEntity: StaffNote::class, mappedBy: 'memberCase')]
|
||||||
private Collection $staffNotes;
|
private Collection $staffNotes;
|
||||||
|
|
||||||
private array $docs;
|
|
||||||
|
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
$this->userCases = new ArrayCollection();
|
$this->userCases = new ArrayCollection();
|
||||||
@ -166,12 +165,12 @@ class MemberCase
|
|||||||
return "{$this->lastName}, {$this->firstName}";
|
return "{$this->lastName}, {$this->firstName}";
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getReferralType(): ?string
|
public function getReferralType(): ?ReferralType
|
||||||
{
|
{
|
||||||
return $this->referralType;
|
return $this->referralType;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setReferralType(string $referralType): static
|
public function setReferralType(ReferralType $referralType): static
|
||||||
{
|
{
|
||||||
$this->referralType = $referralType;
|
$this->referralType = $referralType;
|
||||||
|
|
||||||
@ -507,9 +506,4 @@ class MemberCase
|
|||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getDocs(): array
|
|
||||||
{
|
|
||||||
return $this->docs;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
9
src/Enums/Case/ReferralType.php
Normal file
9
src/Enums/Case/ReferralType.php
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Enums\Case;
|
||||||
|
|
||||||
|
enum ReferralType: string
|
||||||
|
{
|
||||||
|
case DCS = 'DCS';
|
||||||
|
case PO = 'PO';
|
||||||
|
}
|
@ -2,10 +2,12 @@
|
|||||||
|
|
||||||
namespace App\Form;
|
namespace App\Form;
|
||||||
|
|
||||||
|
use App\Entity\CompanyDocument;
|
||||||
use App\Entity\Member;
|
use App\Entity\Member;
|
||||||
use App\Enums\GenderType;
|
use App\Enums\GenderType;
|
||||||
use App\Enums\RaceType;
|
use App\Enums\RaceType;
|
||||||
use App\Enums\RelationshipType;
|
use App\Enums\RelationshipType;
|
||||||
|
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
|
||||||
use Symfony\Component\Form\AbstractType;
|
use Symfony\Component\Form\AbstractType;
|
||||||
use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
|
use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
|
||||||
use Symfony\Component\Form\Extension\Core\Type\DateType;
|
use Symfony\Component\Form\Extension\Core\Type\DateType;
|
||||||
@ -18,6 +20,7 @@ class MemberFormType extends AbstractType
|
|||||||
{
|
{
|
||||||
public function buildForm(FormBuilderInterface $builder, array $options): void
|
public function buildForm(FormBuilderInterface $builder, array $options): void
|
||||||
{
|
{
|
||||||
|
$docs = $options['docs'];
|
||||||
$builder
|
$builder
|
||||||
->add('lastName', null, ['required' => true])
|
->add('lastName', null, ['required' => true])
|
||||||
->add('firstName', null, ['required' => true])
|
->add('firstName', null, ['required' => true])
|
||||||
@ -68,6 +71,14 @@ class MemberFormType extends AbstractType
|
|||||||
->add('dcsApproved', CheckboxType::class, [
|
->add('dcsApproved', CheckboxType::class, [
|
||||||
'mapped' => false
|
'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([
|
$resolver->setDefaults([
|
||||||
'data_class' => Member::class,
|
'data_class' => Member::class,
|
||||||
|
'docs' => [],
|
||||||
'csrf_protection' => true,
|
'csrf_protection' => true,
|
||||||
'csrf_field_name' => '_token',
|
'csrf_field_name' => '_token',
|
||||||
'csrf_token_id' => 'member',
|
'csrf_token_id' => 'member',
|
||||||
|
Loading…
Reference in New Issue
Block a user