src/Billing/Entity/Installment.php line 12

Open in your IDE?
  1. <?php
  2. namespace App\Billing\Entity;
  3. use App\Repository\InstallmentRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\DBAL\Types\Types;
  7. use Doctrine\ORM\Mapping as ORM;
  8. #[ORM\Entity(repositoryClassInstallmentRepository::class)]
  9. class Installment
  10. {
  11.     const STATUS_PENDING 'PENDING';
  12.     const STATUS_PAID 'PAID';
  13.     const STATUS_LATE 'LATE';
  14.     #[ORM\Id]
  15.     #[ORM\GeneratedValue]
  16.     #[ORM\Column]
  17.     private ?int $id null;
  18.     #[ORM\ManyToOne(inversedBy'installments')]
  19.     #[ORM\JoinColumn(nullablefalse)]
  20.     private ?PaymentSchedule $schedule null;
  21.     #[ORM\Column(typeTypes::DECIMALprecision10scale2)]
  22.     private ?string $amount null;
  23.     #[ORM\Column(typeTypes::DATETIME_MUTABLE)]
  24.     private ?\DateTimeInterface $dueDate null;
  25.     #[ORM\Column(length50)]
  26.     private ?string $status self::STATUS_PENDING;
  27.     #[ORM\Column(typeTypes::DATETIME_MUTABLEnullabletrue)]
  28.     private ?\DateTimeInterface $paidAt null;
  29.     #[ORM\Column(typeTypes::DECIMALprecision10scale2)]
  30.     private ?string $paidAmount '0.00';
  31.     #[ORM\ManyToMany(targetEntityPayment::class, mappedBy'installments')]
  32.     private Collection $payments;
  33.     public function __construct()
  34.     {
  35.         $this->payments = new ArrayCollection();
  36.     }
  37.     public function getId(): ?int
  38.     {
  39.         return $this->id;
  40.     }
  41.     public function getPaymentSchedule(): ?PaymentSchedule
  42.     {
  43.         return $this->schedule;
  44.     }
  45.     public function getSchedule(): ?PaymentSchedule
  46.     {
  47.         return $this->schedule;
  48.     }
  49.     public function setSchedule(?PaymentSchedule $schedule): static
  50.     {
  51.         $this->schedule $schedule;
  52.         return $this;
  53.     }
  54.     public function getAmount(): ?string
  55.     {
  56.         return $this->amount;
  57.     }
  58.     public function setAmount(string $amount): static
  59.     {
  60.         $this->amount $amount;
  61.         return $this;
  62.     }
  63.     public function getPaidAmount(): ?string
  64.     {
  65.         return $this->paidAmount;
  66.     }
  67.     public function setPaidAmount(string $paidAmount): static
  68.     {
  69.         $this->paidAmount $paidAmount;
  70.         return $this;
  71.     }
  72.     public function getDueDate(): ?\DateTimeInterface
  73.     {
  74.         return $this->dueDate;
  75.     }
  76.     public function setDueDate(\DateTimeInterface $dueDate): static
  77.     {
  78.         $this->dueDate $dueDate;
  79.         return $this;
  80.     }
  81.     public function getStatus(): ?string
  82.     {
  83.         return $this->status;
  84.     }
  85.     public function setStatus(string $status): static
  86.     {
  87.         $this->status $status;
  88.         return $this;
  89.     }
  90.     public function getPaidAt(): ?\DateTimeInterface
  91.     {
  92.         return $this->paidAt;
  93.     }
  94.     public function setPaidAt(?\DateTimeInterface $paidAt): static
  95.     {
  96.         $this->paidAt $paidAt;
  97.         return $this;
  98.     }
  99.     /**
  100.      * @return Collection<int, Payment>
  101.      */
  102.     public function getPayments(): Collection
  103.     {
  104.         return $this->payments;
  105.     }
  106.     public function addPayment(Payment $payment): static
  107.     {
  108.         if (!$this->payments->contains($payment)) {
  109.             $this->payments->add($payment);
  110.             $payment->addInstallment($this);
  111.         }
  112.         return $this;
  113.     }
  114.     public function removePayment(Payment $payment): static
  115.     {
  116.         if ($this->payments->removeElement($payment)) {
  117.             $payment->removeInstallment($this);
  118.         }
  119.         return $this;
  120.     }
  121. }