src/Entity/PaymentPlan.php line 17

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Entity\SchoolYear;
  4. use App\Repository\PaymentRepository;
  5. use Doctrine\Common\Collections\ArrayCollection;
  6. use Doctrine\Common\Collections\Collection;
  7. use Doctrine\ORM\Mapping as ORM;
  8. /**
  9.  * PaymentPlan
  10.  *
  11.  * @ORM\Table(name="payment_plan")
  12.  * @ORM\Entity(repositoryClass=PaymentRepository::class)
  13.  */
  14. class PaymentPlan
  15. {
  16.   
  17.     /**
  18.      * @var int
  19.      *
  20.      * @ORM\Column(name="id", type="integer")
  21.      * @ORM\Id
  22.      * @ORM\GeneratedValue(strategy="AUTO")
  23.      */
  24.     private $id;
  25.     /**
  26.      * @ORM\OneToOne(targetEntity=SchoolYear::class)
  27.      * @ORM\JoinColumn(name="school_year_id", referencedColumnName="id", nullable=true)
  28.      */
  29.     private $schoolYear;
  30.    
  31.     /**
  32.      * @ORM\OneToMany(targetEntity=Payment::class, mappedBy="paymentPlan")
  33.      */
  34.     private $payments;
  35.      /**
  36.      * @ORM\OneToMany(targetEntity=Installment::class, mappedBy="paymentPlan")
  37.      */
  38.     private $installments;
  39.   
  40.      /**
  41.      * @ORM\Column(type="integer", options={"default" = 0})
  42.      *  
  43.      */
  44.     private $weight;
  45.    
  46.     public function __construct()
  47.     {
  48.         $this->payments = new ArrayCollection();
  49.         $this->installments = new ArrayCollection();
  50.         $this->weight 1;
  51.     }
  52.     public function getId(): ?int
  53.     {
  54.         return $this->id;
  55.     }
  56.     public function getSchoolYear(): ?SchoolYear
  57.     {
  58.         return $this->schoolYear;
  59.     }
  60.     public function setSchoolYear(?SchoolYear $schoolYear): static
  61.     {
  62.         $this->schoolYear $schoolYear;
  63.         return $this;
  64.     }
  65.  
  66.     /**
  67.      * @return Collection<int, Payment>
  68.      */
  69.     public function getPayments(): Collection
  70.     {
  71.         return $this->payments;
  72.     }
  73.     public function addPayment(Payment $payment): static
  74.     {
  75.         if (!$this->payments->contains($payment)) {
  76.             $this->payments->add($payment);
  77.             $payment->setPaymentPlan($this);
  78.         }
  79.         return $this;
  80.     }
  81.     public function removePayment(Payment $payment): static
  82.     {
  83.         if ($this->payments->removeElement($payment)) {
  84.             // set the owning side to null (unless already changed)
  85.             if ($payment->getPaymentPlan() === $this) {
  86.                 $payment->setPaymentPlan(null);
  87.             }
  88.         }
  89.         return $this;
  90.     }
  91.     /**
  92.      * @return Collection<int, Installment>
  93.      */
  94.     public function getInstallments(): Collection
  95.     {
  96.         return $this->installments;
  97.     }
  98.     public function addInstallment(Installment $installment): static
  99.     {
  100.         if (!$this->installments->contains($installment)) {
  101.             $this->installments->add($installment);      
  102.         }
  103.         return $this;
  104.     }
  105.     public function removeInstallment(Installment $installment): static
  106.     {
  107.         $this->installments->removeElement($installment);
  108.         return $this;
  109.     }
  110.     public function getWeight(): ?int
  111.     {
  112.         return $this->weight;
  113.     }
  114.     public function setWeight(int $weight): self
  115.     {
  116.         $this->weight $weight;
  117.         return $this;
  118.     }
  119. }