src/Entity/AggregatedTrueUp.php line 13
<?phpnamespace App\Entity;use App\Repository\AggregatedTrueUpRepository;use Doctrine\Common\Collections\ArrayCollection;use Doctrine\Common\Collections\Collection;use Doctrine\DBAL\Types\Types;use Doctrine\ORM\Mapping as ORM;use Gedmo\Timestampable\Traits\TimestampableEntity;#[ORM\Entity(repositoryClass: AggregatedTrueUpRepository::class)]class AggregatedTrueUp{use TimestampableEntity;#[ORM\Id]#[ORM\GeneratedValue]#[ORM\Column]private ?int $id = null;#[ORM\OneToMany(mappedBy: 'aggregatedTrueUp', targetEntity: TrueUp::class)]private Collection $trueUps;#[ORM\OneToOne(inversedBy: 'aggregatedTrueUp', cascade: ['persist', 'remove'])]private ?ManualPayment $manualPayment = null;#[ORM\ManyToOne(inversedBy: 'aggregatedTrueUps')]#[ORM\JoinColumn(nullable: false)]private ?User $user = null;public function __construct(){$this->trueUps = new ArrayCollection();}public function getId(): ?int{return $this->id;}public function getUser(): ?User{return $this->user;}public function setUser(?User $user): self{$this->user = $user;return $this;}public function getAmtInPennies(): ?int{return array_sum(array_map(fn($x) => round($x->getAmtInPennies(), 2), $this->trueUps->toArray()));}/*** @return Collection<int, TrueUp>*/public function getTrueUps(): Collection{return $this->trueUps;}public function addTrueUp(TrueUp $trueUp): self{if (!$this->trueUps->contains($trueUp)) {$this->trueUps->add($trueUp);$trueUp->setAggregatedTrueUp($this);}return $this;}public function removeTrueUp(TrueUp $trueUp): self{if ($this->trueUps->removeElement($trueUp)) {// set the owning side to null (unless already changed)if ($trueUp->getAggregatedTrueUp() === $this) {$trueUp->setAggregatedTrueUp(null);}}return $this;}public function getManualPayment(): ?ManualPayment{return $this->manualPayment;}public function setManualPayment(?ManualPayment $manualPayment): self{$this->manualPayment = $manualPayment;return $this;}public function __toString(){return $this->user->getFullName() . ' - ' . round(($this->getAmtInPennies() - (float) $this->getManualPayment()?->getAmtInPennies()) / 100.00, 2);}}