src/Entity/EarlyPayment.php line 15

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Entity\GuardianRegister\GuardianRegister;
  4. use App\Repository\EarlyPaymentRepository;
  5. use Doctrine\Common\Collections\ArrayCollection;
  6. use Doctrine\Common\Collections\Collection;
  7. use Doctrine\ORM\Mapping as ORM;
  8. use Symfony\Component\Serializer\Annotation\Groups;
  9. /**
  10. * @ORM\Entity(repositoryClass=EarlyPaymentRepository::class)
  11. */
  12. class EarlyPayment
  13. {
  14. const STATUS_ABANDONED = 'ABANDONED';
  15. const STATUS_PAID = 'PAID';
  16. const STATUS_NOT_PAID = 'NOT_PAID';
  17. /**
  18. * @ORM\Id
  19. * @ORM\GeneratedValue
  20. * @ORM\Column(type="integer")
  21. * @Groups({"PaymentList"})
  22. */
  23. private $id;
  24. /**
  25. * @ORM\ManyToOne(targetEntity=GuardianRegister::class, inversedBy="earlyPayments")
  26. */
  27. private $guardianRegister;
  28. /**
  29. * @ORM\Column(type="datetime", nullable=true)
  30. * @Groups({"PaymentList"})
  31. */
  32. private $createdAt;
  33. /**
  34. * @ORM\ManyToOne(targetEntity=Guardian::class, inversedBy="earlyPayments")
  35. */
  36. private $guardian;
  37. /**
  38. * @ORM\Column(type="float", nullable=true)
  39. * @Groups({"PaymentList"})
  40. */
  41. private $amount;
  42. /**
  43. * @ORM\Column(type="string", length=255, nullable=true)
  44. * @Groups({"PaymentList"})
  45. */
  46. private $status;
  47. /**
  48. * @ORM\Column(type="string", length=255, nullable=true)
  49. */
  50. private $uuid;
  51. /**
  52. * @ORM\OneToMany(targetEntity=MontonioLog::class, mappedBy="earlyPayment")
  53. */
  54. private $montonioLogs;
  55. /**
  56. * @ORM\OneToMany(targetEntity=MontonioWebhookLog::class, mappedBy="earlyPayment")
  57. */
  58. private $montonioWebhookLogs;
  59. /**
  60. * @ORM\Column(type="datetime", nullable=true)
  61. * @Groups({"PaymentList"})
  62. */
  63. private $dateFor;
  64. /**
  65. * @ORM\Column(type="datetime", nullable=true)
  66. * @Groups({"PaymentList"})
  67. */
  68. private $updatedAt;
  69. /**
  70. * @ORM\ManyToOne(targetEntity=Admin::class)
  71. */
  72. private $admin;
  73. public function __construct()
  74. {
  75. $this->montonioLogs = new ArrayCollection();
  76. $this->montonioWebhookLogs = new ArrayCollection();
  77. $this->createdAt = new \Datetime();
  78. }
  79. public function getId(): ?int
  80. {
  81. return $this->id;
  82. }
  83. public function getGuardianRegister(): ?GuardianRegister
  84. {
  85. return $this->guardianRegister;
  86. }
  87. public function setGuardianRegister(?GuardianRegister $guardianRegister): self
  88. {
  89. $this->guardianRegister = $guardianRegister;
  90. return $this;
  91. }
  92. public function getCreatedAt(): ?\DateTimeInterface
  93. {
  94. return $this->createdAt;
  95. }
  96. public function setCreatedAt(?\DateTimeInterface $createdAt): self
  97. {
  98. $this->createdAt = $createdAt;
  99. return $this;
  100. }
  101. public function getGuardian(): ?Guardian
  102. {
  103. return $this->guardian;
  104. }
  105. public function setGuardian(?Guardian $guardian): self
  106. {
  107. $this->guardian = $guardian;
  108. return $this;
  109. }
  110. public function getAmount(): ?float
  111. {
  112. return $this->amount;
  113. }
  114. public function setAmount(?float $amount): self
  115. {
  116. $this->amount = $amount;
  117. return $this;
  118. }
  119. public function getStatus(): ?string
  120. {
  121. return $this->status;
  122. }
  123. public function setStatus(?string $status): self
  124. {
  125. $this->status = $status;
  126. return $this;
  127. }
  128. public function getUuid(): ?string
  129. {
  130. return $this->uuid;
  131. }
  132. public function setUuid(?string $uuid): self
  133. {
  134. $this->uuid = $uuid;
  135. return $this;
  136. }
  137. /**
  138. * @return Collection<int, MontonioLog>
  139. */
  140. public function getMontonioLogs(): Collection
  141. {
  142. return $this->montonioLogs;
  143. }
  144. public function addMontonioLog(MontonioLog $montonioLog): self
  145. {
  146. if (!$this->montonioLogs->contains($montonioLog)) {
  147. $this->montonioLogs[] = $montonioLog;
  148. $montonioLog->setEarlyPayment($this);
  149. }
  150. return $this;
  151. }
  152. public function removeMontonioLog(MontonioLog $montonioLog): self
  153. {
  154. if ($this->montonioLogs->removeElement($montonioLog)) {
  155. // set the owning side to null (unless already changed)
  156. if ($montonioLog->getEarlyPayment() === $this) {
  157. $montonioLog->setEarlyPayment(null);
  158. }
  159. }
  160. return $this;
  161. }
  162. /**
  163. * @return Collection<int, MontonioWebhookLog>
  164. */
  165. public function getMontonioWebhookLogs(): Collection
  166. {
  167. return $this->montonioWebhookLogs;
  168. }
  169. public function addMontonioWebhookLog(MontonioWebhookLog $montonioWebhookLog): self
  170. {
  171. if (!$this->montonioWebhookLogs->contains($montonioWebhookLog)) {
  172. $this->montonioWebhookLogs[] = $montonioWebhookLog;
  173. $montonioWebhookLog->setEarlyPayment($this);
  174. }
  175. return $this;
  176. }
  177. public function removeMontonioWebhookLog(MontonioWebhookLog $montonioWebhookLog): self
  178. {
  179. if ($this->montonioWebhookLogs->removeElement($montonioWebhookLog)) {
  180. // set the owning side to null (unless already changed)
  181. if ($montonioWebhookLog->getEarlyPayment() === $this) {
  182. $montonioWebhookLog->setEarlyPayment(null);
  183. }
  184. }
  185. return $this;
  186. }
  187. public function getDateFor(): ?\DateTimeInterface
  188. {
  189. return $this->dateFor;
  190. }
  191. public function setDateFor(?\DateTimeInterface $dateFor): self
  192. {
  193. $this->dateFor = $dateFor;
  194. return $this;
  195. }
  196. public function getUpdatedAt(): ?\DateTimeInterface
  197. {
  198. return $this->updatedAt;
  199. }
  200. public function setUpdatedAt(?\DateTimeInterface $updatedAt): self
  201. {
  202. $this->updatedAt = $updatedAt;
  203. return $this;
  204. }
  205. public function getAdmin(): ?Admin
  206. {
  207. return $this->admin;
  208. }
  209. public function setAdmin(?Admin $admin): self
  210. {
  211. $this->admin = $admin;
  212. return $this;
  213. }
  214. }