src/Billing/Entity/PaymentSchedule.php line 12

Open in your IDE?
  1. <?php
  2. namespace App\Billing\Entity;
  3. use App\Repository\PaymentScheduleRepository;
  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(repositoryClassPaymentScheduleRepository::class)]
  9. class PaymentSchedule
  10. {
  11.     #[ORM\Id]
  12.     #[ORM\GeneratedValue]
  13.     #[ORM\Column]
  14.     private ?int $id null;
  15.     #[ORM\OneToOne(inversedBy'paymentSchedule'cascade: ['persist''remove'])]
  16.     #[ORM\JoinColumn(nullablefalse)]
  17.     private ?Invoice $invoice null;
  18.     #[ORM\OneToMany(mappedBy'schedule'targetEntityInstallment::class, cascade: ['persist''remove'], orphanRemovaltrue)]
  19.     private Collection $installments;
  20.     public function __construct()
  21.     {
  22.         $this->installments = new ArrayCollection();
  23.     }
  24.     public function getId(): ?int
  25.     {
  26.         return $this->id;
  27.     }
  28.     public function getInvoice(): ?Invoice
  29.     {
  30.         return $this->invoice;
  31.     }
  32.     public function setInvoice(Invoice $invoice): static
  33.     {
  34.         $this->invoice $invoice;
  35.         return $this;
  36.     }
  37.     /**
  38.      * @return Collection<int, Installment>
  39.      */
  40.     public function getInstallments(): Collection
  41.     {
  42.         return $this->installments;
  43.     }
  44.     public function addInstallment(Installment $installment): static
  45.     {
  46.         if (!$this->installments->contains($installment)) {
  47.             $this->installments->add($installment);
  48.             $installment->setSchedule($this);
  49.         }
  50.         return $this;
  51.     }
  52.     public function removeInstallment(Installment $installment): static
  53.     {
  54.         if ($this->installments->removeElement($installment)) {
  55.             // set the owning side to null (unless already changed)
  56.             if ($installment->getSchedule() === $this) {
  57.                 $installment->setSchedule(null);
  58.             }
  59.         }
  60.         return $this;
  61.     }
  62. }