reconfigure

This commit is contained in:
Ryan Prather 2025-01-05 06:04:21 +00:00
parent 91723ed9be
commit c78698ace4

View File

@ -43,18 +43,6 @@ class Referral
#[ORM\Column(type: Types::DATE_MUTABLE, nullable: true)]
private ?\DateTimeInterface $dischargeDate = null;
/**
* @var Collection<int, Note>
*/
#[ORM\OneToMany(targetEntity: Note::class, mappedBy: 'referral', orphanRemoval: true)]
private Collection $notes;
/**
* @var Collection<int, Member>
*/
#[ORM\ManyToMany(targetEntity: Member::class)]
private Collection $present;
/**
* @var float $hoursUsed
*/
@ -65,8 +53,6 @@ class Referral
*/
public function __construct()
{
$this->notes = new ArrayCollection();
$this->present = new ArrayCollection();
$this->hoursUsed = 0.0;
}
@ -159,74 +145,13 @@ class Referral
return $this;
}
/**
* @return Collection<int, Note>
*/
public function getNotes(): Collection
{
return $this->notes;
}
public function addNote(Note $note): static
{
if (!$this->notes->contains($note)) {
$this->notes->add($note);
$note->setReferral($this);
$this->hoursUsed += ($note->calcTimeUsed() / 60);
}
return $this;
}
public function removeNote(Note $note): static
{
if ($this->notes->removeElement($note)) {
$this->hoursUsed -= $note->calcTimeUsed();
// set the owning side to null (unless already changed)
if ($note->getReferral() === $this) {
$note->setReferral(null);
}
}
return $this;
}
public function setNotes(ArrayCollection $notes): void
{
$this->notes = $notes;
$this->hoursUsed = 0.0;
foreach ($this->notes as $note) {
$this->hoursUsed += ($note->calcTimeUsed() / 60);
}
}
/**
* @return Collection<int, Member>
*/
public function getPresent(): Collection
{
return $this->present;
}
public function addPresent(Member $present): static
{
if (!$this->present->contains($present)) {
$this->present->add($present);
}
return $this;
}
public function removePresent(Member $present): static
{
$this->present->removeElement($present);
return $this;
}
public function getHoursRemaining(): float
{
return $this->hours - $this->hoursUsed;
}
public function getHoursUsed(): float
{
return $this->hoursUsed;
}
}