BillPayment.php 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179
  1. <?php
  2. declare(strict_types=1);
  3. namespace App\Entity\Billing;
  4. use App\Entity\Core\Tagg;
  5. // use DH\Auditor\Provider\Doctrine\Auditing\Annotation\Auditable;
  6. use Doctrine\Common\Collections\ArrayCollection;
  7. use Doctrine\Common\Collections\Collection;
  8. use Doctrine\ORM\Mapping as ORM;
  9. /**
  10. * Classe ... qui ...
  11. */
  12. // #[Auditable]
  13. #[ORM\Entity]
  14. class BillPayment
  15. {
  16. #[ORM\Id]
  17. #[ORM\Column]
  18. #[ORM\GeneratedValue]
  19. private ?int $id = null;
  20. #[ORM\ManyToOne(cascade: ['persist'], inversedBy: 'billPayments')]
  21. #[ORM\JoinColumn(nullable: true)]
  22. private AbstractBillAccounting $bill;
  23. #[ORM\ManyToOne(cascade: ['persist'], inversedBy: 'billDetachedPayments')]
  24. #[ORM\JoinColumn(nullable: true)]
  25. private AccessBilling $accessBilling;
  26. #[ORM\OneToMany(mappedBy: 'billPayment', targetEntity: BillDebitBalance::class, cascade: ['persist'], orphanRemoval: true)]
  27. #[ORM\JoinColumn(nullable: true)]
  28. private Collection $billDebitBalances;
  29. #[ORM\ManyToOne(cascade: ['persist'], inversedBy: 'accountBalanceReimbursements')]
  30. #[ORM\JoinColumn(nullable: true)]
  31. private AccessBilling $accessBillingAccountBalanceReimbursement;
  32. #[ORM\ManyToMany(targetEntity: Tagg::class, inversedBy: 'payments', cascade: ['persist'])]
  33. #[ORM\JoinTable(name: 'tag_billPayment')]
  34. #[ORM\JoinColumn(name: 'billPayment_id', referencedColumnName: 'id')]
  35. #[ORM\InverseJoinColumn(name: 'tag_id', referencedColumnName: 'id')]
  36. private Collection $tags;
  37. #[ORM\ManyToOne(targetEntity: SddBank::class, cascade: ['persist'], inversedBy: 'billPayments')]
  38. #[ORM\JoinColumn(referencedColumnName: 'id', nullable: true, onDelete: 'SET NULL')]
  39. protected SddBank $sddBank;
  40. #[ORM\ManyToOne(targetEntity: SddRegie::class, cascade: ['persist'], inversedBy: 'billPayments')]
  41. #[ORM\JoinColumn(referencedColumnName: 'id', nullable: true, onDelete: 'SET NULL')]
  42. protected SddRegie $sddRegie;
  43. public function __construct()
  44. {
  45. $this->billDebitBalances = new ArrayCollection();
  46. $this->tags = new ArrayCollection();
  47. }
  48. public function getId(): ?int
  49. {
  50. return $this->id;
  51. }
  52. public function getBill(): ?AbstractBillAccounting
  53. {
  54. return $this->bill;
  55. }
  56. public function setBill(?AbstractBillAccounting $bill): self
  57. {
  58. $this->bill = $bill;
  59. return $this;
  60. }
  61. public function getAccessBilling(): ?AccessBilling
  62. {
  63. return $this->accessBilling;
  64. }
  65. public function setAccessBilling(?AccessBilling $accessBilling): self
  66. {
  67. $this->accessBilling = $accessBilling;
  68. return $this;
  69. }
  70. /**
  71. * @return Collection<int, BillDebitBalance>
  72. */
  73. public function getBillDebitBalances(): Collection
  74. {
  75. return $this->billDebitBalances;
  76. }
  77. public function addBillDebitBalance(BillDebitBalance $billDebitBalance): self
  78. {
  79. if (!$this->billDebitBalances->contains($billDebitBalance)) {
  80. $this->billDebitBalances[] = $billDebitBalance;
  81. $billDebitBalance->setBillPayment($this);
  82. }
  83. return $this;
  84. }
  85. public function removeBillDebitBalance(BillDebitBalance $billDebitBalance): self
  86. {
  87. if ($this->billDebitBalances->removeElement($billDebitBalance)) {
  88. // set the owning side to null (unless already changed)
  89. if ($billDebitBalance->getBillPayment() === $this) {
  90. $billDebitBalance->setBillPayment(null);
  91. }
  92. }
  93. return $this;
  94. }
  95. public function getAccessBillingAccountBalanceReimbursement(): ?AccessBilling
  96. {
  97. return $this->accessBillingAccountBalanceReimbursement;
  98. }
  99. public function setAccessBillingAccountBalanceReimbursement(?AccessBilling $accessBillingAccountBalanceReimbursement): self
  100. {
  101. $this->accessBillingAccountBalanceReimbursement = $accessBillingAccountBalanceReimbursement;
  102. return $this;
  103. }
  104. /**
  105. * @return Collection<int, Tagg>
  106. */
  107. public function getTags(): Collection
  108. {
  109. return $this->tags;
  110. }
  111. public function addTag(Tagg $tag): self
  112. {
  113. if (!$this->tags->contains($tag)) {
  114. $this->tags[] = $tag;
  115. }
  116. return $this;
  117. }
  118. public function removeTag(Tagg $tag): self
  119. {
  120. $this->tags->removeElement($tag);
  121. return $this;
  122. }
  123. public function getSddBank(): SddBank
  124. {
  125. return $this->sddBank;
  126. }
  127. public function setSddBank(SddBank $sddBank): self
  128. {
  129. $this->sddBank = $sddBank;
  130. return $this;
  131. }
  132. public function getSddRegie(): SddRegie
  133. {
  134. return $this->sddRegie;
  135. }
  136. public function setSddRegie(SddRegie $sddRegie): self
  137. {
  138. $this->sddRegie = $sddRegie;
  139. return $this;
  140. }
  141. }