src/Finance/Domain/Entity/TuitionInstallment.php line 14

Open in your IDE?
  1. <?php
  2. namespace App\Finance\Domain\Entity;
  3. use App\Finance\Domain\Repository\TuitionInstallmentRepository;
  4. use Doctrine\DBAL\Types\Types;
  5. use Doctrine\ORM\Mapping as ORM;
  6. use Symfony\Component\Validator\Constraints as Assert;
  7. #[ORM\Entity(repositoryClass: TuitionInstallmentRepository::class)]
  8. #[ORM\Table(name: 'tuition_installments')]
  9. #[ORM\Index(columns: ['school_year_id'], name: 'idx_school_year')]
  10. #[ORM\Index(columns: ['installment_number'], name: 'idx_installment_number')]
  11. class TuitionInstallment
  12. {
  13. #[ORM\Id]
  14. #[ORM\GeneratedValue]
  15. #[ORM\Column(type: Types::INTEGER)]
  16. private ?int $id = null;
  17. #[ORM\Column(type: Types::INTEGER)]
  18. #[Assert\NotNull]
  19. private int $schoolYearId;
  20. #[ORM\Column(type: Types::INTEGER)]
  21. #[Assert\NotNull]
  22. #[Assert\Positive]
  23. private int $installmentNumber;
  24. #[ORM\Column(type: Types::STRING, length: 255)]
  25. #[Assert\NotBlank]
  26. private string $name;
  27. #[ORM\Column(type: Types::DECIMAL, precision: 10, scale: 2)]
  28. #[Assert\NotNull]
  29. #[Assert\PositiveOrZero]
  30. private string $amount;
  31. #[ORM\Column(type: Types::DATE_IMMUTABLE)]
  32. #[Assert\NotNull]
  33. private \DateTimeImmutable $dueDate;
  34. #[ORM\Column(type: Types::BOOLEAN, options: ['default' => true])]
  35. private bool $isActive = true;
  36. #[ORM\Column(type: Types::DATETIME_IMMUTABLE)]
  37. private \DateTimeImmutable $createdAt;
  38. #[ORM\Column(type: Types::DATETIME_IMMUTABLE)]
  39. private \DateTimeImmutable $updatedAt;
  40. public function __construct()
  41. {
  42. $this->createdAt = new \DateTimeImmutable();
  43. $this->updatedAt = new \DateTimeImmutable();
  44. }
  45. public function getId(): ?int
  46. {
  47. return $this->id;
  48. }
  49. public function getSchoolYearId(): int
  50. {
  51. return $this->schoolYearId;
  52. }
  53. public function setSchoolYearId(int $schoolYearId): self
  54. {
  55. $this->schoolYearId = $schoolYearId;
  56. $this->updatedAt = new \DateTimeImmutable();
  57. return $this;
  58. }
  59. public function getInstallmentNumber(): int
  60. {
  61. return $this->installmentNumber;
  62. }
  63. public function setInstallmentNumber(int $installmentNumber): self
  64. {
  65. $this->installmentNumber = $installmentNumber;
  66. $this->updatedAt = new \DateTimeImmutable();
  67. return $this;
  68. }
  69. public function getName(): string
  70. {
  71. return $this->name;
  72. }
  73. public function setName(string $name): self
  74. {
  75. $this->name = $name;
  76. $this->updatedAt = new \DateTimeImmutable();
  77. return $this;
  78. }
  79. public function getAmount(): string
  80. {
  81. return $this->amount;
  82. }
  83. public function setAmount(string $amount): self
  84. {
  85. $this->amount = $amount;
  86. $this->updatedAt = new \DateTimeImmutable();
  87. return $this;
  88. }
  89. public function getDueDate(): \DateTimeImmutable
  90. {
  91. return $this->dueDate;
  92. }
  93. public function setDueDate(\DateTimeImmutable $dueDate): self
  94. {
  95. $this->dueDate = $dueDate;
  96. $this->updatedAt = new \DateTimeImmutable();
  97. return $this;
  98. }
  99. public function isActive(): bool
  100. {
  101. return $this->isActive;
  102. }
  103. public function setIsActive(bool $isActive): self
  104. {
  105. $this->isActive = $isActive;
  106. $this->updatedAt = new \DateTimeImmutable();
  107. return $this;
  108. }
  109. public function getCreatedAt(): \DateTimeImmutable
  110. {
  111. return $this->createdAt;
  112. }
  113. public function getUpdatedAt(): \DateTimeImmutable
  114. {
  115. return $this->updatedAt;
  116. }
  117. }