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