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,inversedBy="paymentPlan")
  27.      * @ORM\JoinColumn(name="school_year_id", referencedColumnName="id", nullable=true)
  28.      */
  29.     private $schoolYear;
  30.    
  31.     
  32.      /**
  33.      * @ORM\OneToMany(targetEntity=Installment::class, mappedBy="paymentPlan")
  34.      */
  35.     private $installments;
  36.   
  37.      /**
  38.      * @ORM\Column(type="integer", options={"default" = 0})
  39.      *  
  40.      */
  41.     private $weight;
  42.    
  43.     public function __construct()
  44.     {
  45.         $this->payments = new ArrayCollection();
  46.         $this->installments = new ArrayCollection();
  47.         $this->weight 1;
  48.     }
  49.     public function getId(): ?int
  50.     {
  51.         return $this->id;
  52.     }
  53.     public function getSchoolYear(): ?SchoolYear
  54.     {
  55.         return $this->schoolYear;
  56.     }
  57.     public function setSchoolYear(?SchoolYear $schoolYear): static
  58.     {
  59.         $this->schoolYear $schoolYear;
  60.         return $this;
  61.     }
  62.  
  63.     
  64.     /**
  65.      * @return Collection<int, Installment>
  66.      */
  67.     public function getInstallments(): Collection
  68.     {
  69.         return $this->installments;
  70.     }
  71.     public function addInstallment(Installment $installment): static
  72.     {
  73.         if (!$this->installments->contains($installment)) {
  74.             $this->installments->add($installment);      
  75.         }
  76.         return $this;
  77.     }
  78.     public function removeInstallment(Installment $installment): static
  79.     {
  80.         $this->installments->removeElement($installment);
  81.         return $this;
  82.     }
  83.     public function getWeight(): ?int
  84.     {
  85.         return $this->weight;
  86.     }
  87.     public function setWeight(int $weight): self
  88.     {
  89.         $this->weight $weight;
  90.         return $this;
  91.     }
  92. }