mv: Refactor
* Move entities for organization
This commit is contained in:
50
src/Entity/Case/StandardNote.php
Normal file
50
src/Entity/Case/StandardNote.php
Normal file
@ -0,0 +1,50 @@
|
||||
<?php
|
||||
|
||||
namespace App\Entity\Case;
|
||||
|
||||
use App\Enums\Case\ReferralServiceType;
|
||||
use App\Repository\Case\StandardNoteRepository;
|
||||
use Doctrine\DBAL\Types\Types;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
use JsonSerializable;
|
||||
|
||||
#[ORM\Entity(repositoryClass: StandardNoteRepository::class)]
|
||||
class StandardNote extends Note implements JsonSerializable
|
||||
{
|
||||
#[ORM\Column(type: Types::TEXT, nullable: true)]
|
||||
private ?string $note = null;
|
||||
|
||||
public function getNote(): ?string
|
||||
{
|
||||
return $this->note;
|
||||
}
|
||||
|
||||
public function setNote(?string $note): static
|
||||
{
|
||||
$this->note = $note;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function jsonSerialize(): array
|
||||
{
|
||||
$members = [];
|
||||
foreach ($this->getMembers() as $member) {
|
||||
/** @var Member $member */
|
||||
$members[] = $member->getName();
|
||||
}
|
||||
return [
|
||||
'id' => $this->getId()->toString(),
|
||||
'date' => $this->getDate()->format('M j, Y'),
|
||||
'startTime' => $this->getStartTime()->format('g:i a'),
|
||||
'endTime' => $this->getEndTime()->format('g:i a'),
|
||||
'serviceCode' => $this->getReferral()->getServiceCode()->value,
|
||||
'noteType' => ($this->getReferral()->getServiceCode() == ReferralServiceType::VS_THBB ? 'visit' : 'standard'),
|
||||
'status' => $this->getStatus()->value,
|
||||
'location' => $this->getLocation()->value,
|
||||
'method' => ucwords(str_replace('_', ' ', strtolower($this->getMethod()->name))),
|
||||
'members' => implode(', ', $members),
|
||||
'duration' => $this->calcTimeUsed(),
|
||||
];
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user