AccessBilling.php 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201
  1. <?php
  2. declare(strict_types=1);
  3. namespace App\Entity\Billing;
  4. use ApiPlatform\Metadata\ApiResource;
  5. // use DH\Auditor\Provider\Doctrine\Auditing\Annotation\Auditable;
  6. use App\Entity\Access\Access;
  7. use Doctrine\Common\Collections\ArrayCollection;
  8. use Doctrine\Common\Collections\Collection;
  9. use Doctrine\ORM\Mapping as ORM;
  10. /**
  11. * Classe ... qui ...
  12. */
  13. #[ApiResource(operations: [])]
  14. // #[Auditable]
  15. #[ORM\Entity]
  16. class AccessBilling
  17. {
  18. #[ORM\Column]
  19. #[ORM\Id]
  20. #[ORM\GeneratedValue]
  21. private ?int $id = null;
  22. #[ORM\OneToOne(inversedBy: 'accessBilling', cascade: ['persist'], fetch: 'EAGER')]
  23. #[ORM\JoinColumn(nullable: true, onDelete: 'CASCADE')]
  24. private Access $access;
  25. #[ORM\ManyToOne(cascade: ['persist'], inversedBy: 'accessBilling')]
  26. #[ORM\JoinColumn(referencedColumnName: 'id', nullable: true, onDelete: 'SET NULL')]
  27. private FamilyQuotient $familyQuotient;
  28. #[ORM\ManyToOne(cascade: ['persist'], inversedBy: 'accessBilling')]
  29. #[ORM\JoinColumn(referencedColumnName: 'id', nullable: true, onDelete: 'SET NULL')]
  30. private ResidenceArea $residenceArea;
  31. #[ORM\OneToMany(mappedBy: 'accessBilling', targetEntity: BillPayment::class, cascade: ['persist'], orphanRemoval: true)]
  32. private Collection $billDetachedPayments;
  33. #[ORM\OneToMany(mappedBy: 'accessBilling', targetEntity: BillDebitBalance::class, cascade: ['persist'], orphanRemoval: true)]
  34. private Collection $billDebitBalances;
  35. #[ORM\OneToMany(mappedBy: 'accessBillingAccountBalanceReimbursement', targetEntity: BillPayment::class, cascade: ['persist'], orphanRemoval: true)]
  36. private Collection $accountBalanceReimbursements;
  37. #[ORM\ManyToOne(targetEntity: BillSchedule::class, cascade: ['persist'], inversedBy: 'accessBilling')]
  38. #[ORM\JoinColumn(referencedColumnName: 'id', nullable: true, onDelete: 'SET NULL')]
  39. protected BillSchedule $billSchedule;
  40. public function __construct()
  41. {
  42. $this->billDetachedPayments = new ArrayCollection();
  43. $this->billDebitBalances = new ArrayCollection();
  44. $this->accountBalanceReimbursements = new ArrayCollection();
  45. }
  46. public function getId(): ?int
  47. {
  48. return $this->id;
  49. }
  50. public function getFamilyQuotient(): ?FamilyQuotient
  51. {
  52. return $this->familyQuotient;
  53. }
  54. public function setFamilyQuotient(?FamilyQuotient $familyQuotient): self
  55. {
  56. $this->familyQuotient = $familyQuotient;
  57. return $this;
  58. }
  59. public function getResidenceArea(): ?ResidenceArea
  60. {
  61. return $this->residenceArea;
  62. }
  63. public function setResidenceArea(?ResidenceArea $residenceArea): self
  64. {
  65. $this->residenceArea = $residenceArea;
  66. return $this;
  67. }
  68. /**
  69. * @return Collection<int, BillPayment>
  70. */
  71. public function getBillDetachedPayments(): Collection
  72. {
  73. return $this->billDetachedPayments;
  74. }
  75. public function addBillDetachedPayment(BillPayment $billDetachedPayment): self
  76. {
  77. if (!$this->billDetachedPayments->contains($billDetachedPayment)) {
  78. $this->billDetachedPayments[] = $billDetachedPayment;
  79. $billDetachedPayment->setAccessBilling($this);
  80. }
  81. return $this;
  82. }
  83. public function removeBillDetachedPayment(BillPayment $billDetachedPayment): self
  84. {
  85. if ($this->billDetachedPayments->removeElement($billDetachedPayment)) {
  86. // set the owning side to null (unless already changed)
  87. if ($billDetachedPayment->getAccessBilling() === $this) {
  88. $billDetachedPayment->setAccessBilling(null);
  89. }
  90. }
  91. return $this;
  92. }
  93. /**
  94. * @return Collection<int, BillDebitBalance>
  95. */
  96. public function getBillDebitBalances(): Collection
  97. {
  98. return $this->billDebitBalances;
  99. }
  100. public function addBillDebitBalance(BillDebitBalance $billDebitBalance): self
  101. {
  102. if (!$this->billDebitBalances->contains($billDebitBalance)) {
  103. $this->billDebitBalances[] = $billDebitBalance;
  104. $billDebitBalance->setAccessBilling($this);
  105. }
  106. return $this;
  107. }
  108. public function removeBillDebitBalance(BillDebitBalance $billDebitBalance): self
  109. {
  110. if ($this->billDebitBalances->removeElement($billDebitBalance)) {
  111. // set the owning side to null (unless already changed)
  112. if ($billDebitBalance->getAccessBilling() === $this) {
  113. $billDebitBalance->setAccessBilling(null);
  114. }
  115. }
  116. return $this;
  117. }
  118. /**
  119. * @return Collection<int, BillPayment>
  120. */
  121. public function getAccountBalanceReimbursements(): Collection
  122. {
  123. return $this->accountBalanceReimbursements;
  124. }
  125. public function addAccountBalanceReimbursement(BillPayment $accountBalanceReimbursement): self
  126. {
  127. if (!$this->accountBalanceReimbursements->contains($accountBalanceReimbursement)) {
  128. $this->accountBalanceReimbursements[] = $accountBalanceReimbursement;
  129. $accountBalanceReimbursement->setAccessBillingAccountBalanceReimbursement($this);
  130. }
  131. return $this;
  132. }
  133. public function removeAccountBalanceReimbursement(BillPayment $accountBalanceReimbursement): self
  134. {
  135. if ($this->accountBalanceReimbursements->removeElement($accountBalanceReimbursement)) {
  136. // set the owning side to null (unless already changed)
  137. if ($accountBalanceReimbursement->getAccessBillingAccountBalanceReimbursement() === $this) {
  138. $accountBalanceReimbursement->setAccessBillingAccountBalanceReimbursement(null);
  139. }
  140. }
  141. return $this;
  142. }
  143. public function getAccess(): ?Access
  144. {
  145. return $this->access;
  146. }
  147. public function setAccess(?Access $access): self
  148. {
  149. $this->access = $access;
  150. return $this;
  151. }
  152. public function getBillSchedule(): BillSchedule
  153. {
  154. return $this->billSchedule;
  155. }
  156. public function setBillSchedule(BillSchedule $billSchedule): self
  157. {
  158. $this->billSchedule = $billSchedule;
  159. return $this;
  160. }
  161. }