src/Entity/Payment.php line 17

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Entity\Student;
  4. use App\Entity\SchoolYear;
  5. use App\Repository\PaymentRepository;
  6. use Doctrine\ORM\Mapping as ORM;
  7. use App\Entity\Traits\TimeStampable;
  8. use App\Entity\Traits\Amount;
  9. /**
  10. * Payment
  11. *
  12. * @ORM\Table(name="payment")
  13. * @ORM\Entity(repositoryClass=PaymentRepository::class)
  14. */
  15. class Payment
  16. {
  17. use TimeStampable;
  18. use Amount;
  19. public const NUM_ITEMS_PER_PAGE = 20;
  20. /**
  21. * @var int
  22. *
  23. * @ORM\Column(name="id", type="integer")
  24. * @ORM\Id
  25. * @ORM\GeneratedValue(strategy="AUTO")
  26. */
  27. private $id;
  28. /**
  29. * @ORM\Column(type="string", length=25, nullable=true, unique=true)
  30. */
  31. private $code;
  32. /**
  33. * @ORM\ManyToOne(targetEntity=SchoolYear::class)
  34. * @ORM\JoinColumn(name="school_year_id", referencedColumnName="id", nullable=true)
  35. */
  36. private $schoolYear;
  37. /**
  38. * @ORM\ManyToOne(targetEntity=Student::class,inversedBy="payments")
  39. * @ORM\JoinColumn(name="student_id", referencedColumnName="id", nullable=true)
  40. */
  41. private $student;
  42. /**
  43. * @var boolean
  44. *
  45. * @ORM\Column(name="subscription", type="boolean", options={"default":false})
  46. */
  47. private $subscription = false;
  48. public function __construct()
  49. {
  50. $this->createdAt= new \DateTime();
  51. $this->updatedAt= new \DateTime();
  52. }
  53. /**
  54. * Get id
  55. *
  56. * @return int
  57. */
  58. public function getId()
  59. {
  60. return $this->id;
  61. }
  62. public function getCode(): ?string
  63. {
  64. return $this->code;
  65. }
  66. public function setCode(string $code): self
  67. {
  68. $this->code = $code;
  69. return $this;
  70. }
  71. /**
  72. * Set schoolYear
  73. *
  74. * @param SchoolYear $schoolYear
  75. *
  76. * @return Payment
  77. */
  78. public function setSchoolYear(SchoolYear $schoolYear = null)
  79. {
  80. $this->schoolYear = $schoolYear;
  81. return $this;
  82. }
  83. /**
  84. * Get schoolYear
  85. *
  86. * @return SchoolYear
  87. */
  88. public function getSchoolYear()
  89. {
  90. return $this->schoolYear;
  91. }
  92. /**
  93. * Set student
  94. *
  95. * @param Student $student
  96. *
  97. * @return Payment
  98. */
  99. public function setStudent(Student $student = null)
  100. {
  101. $this->student = $student;
  102. return $this;
  103. }
  104. /**
  105. * Get student
  106. *
  107. * @return Student
  108. */
  109. public function getStudent()
  110. {
  111. return $this->student;
  112. }
  113. public function isSubscription(): ?bool
  114. {
  115. return $this->subscription;
  116. }
  117. public function setSubscription(bool $subscription): static
  118. {
  119. $this->subscription = $subscription;
  120. return $this;
  121. }
  122. }