AccessBilling.php 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204
  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. * Paramètres de facturation pour un Access.
  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 = null;
  25. #[ORM\ManyToOne(cascade: ['persist'], inversedBy: 'accessBilling')]
  26. #[ORM\JoinColumn(referencedColumnName: 'id', nullable: true, onDelete: 'SET NULL')]
  27. private ?FamilyQuotient $familyQuotient = null;
  28. #[ORM\ManyToOne(cascade: ['persist'], inversedBy: 'accessBilling')]
  29. #[ORM\JoinColumn(referencedColumnName: 'id', nullable: true, onDelete: 'SET NULL')]
  30. private ?ResidenceArea $residenceArea = null;
  31. /** @var Collection<int, BillPayment> */
  32. #[ORM\OneToMany(targetEntity: BillPayment::class, mappedBy: 'accessBilling', cascade: ['persist'], orphanRemoval: true)]
  33. private Collection $billDetachedPayments;
  34. /** @var Collection<int, BillDebitBalance> */
  35. #[ORM\OneToMany(targetEntity: BillDebitBalance::class, mappedBy: 'accessBilling', cascade: ['persist'], orphanRemoval: true)]
  36. private Collection $billDebitBalances;
  37. /** @var Collection<int, BillPayment> */
  38. #[ORM\OneToMany(targetEntity: BillPayment::class, mappedBy: 'accessBillingAccountBalanceReimbursement', cascade: ['persist'], orphanRemoval: true)]
  39. private Collection $accountBalanceReimbursements;
  40. #[ORM\ManyToOne(targetEntity: BillSchedule::class, cascade: ['persist'], inversedBy: 'accessBilling')]
  41. #[ORM\JoinColumn(referencedColumnName: 'id', nullable: true, onDelete: 'SET NULL')]
  42. protected ?BillSchedule $billSchedule;
  43. public function __construct()
  44. {
  45. $this->billDetachedPayments = new ArrayCollection();
  46. $this->billDebitBalances = new ArrayCollection();
  47. $this->accountBalanceReimbursements = new ArrayCollection();
  48. }
  49. public function getId(): ?int
  50. {
  51. return $this->id;
  52. }
  53. public function getFamilyQuotient(): ?FamilyQuotient
  54. {
  55. return $this->familyQuotient;
  56. }
  57. public function setFamilyQuotient(?FamilyQuotient $familyQuotient): self
  58. {
  59. $this->familyQuotient = $familyQuotient;
  60. return $this;
  61. }
  62. public function getResidenceArea(): ?ResidenceArea
  63. {
  64. return $this->residenceArea;
  65. }
  66. public function setResidenceArea(?ResidenceArea $residenceArea): self
  67. {
  68. $this->residenceArea = $residenceArea;
  69. return $this;
  70. }
  71. /**
  72. * @return Collection<int, BillPayment>
  73. */
  74. public function getBillDetachedPayments(): Collection
  75. {
  76. return $this->billDetachedPayments;
  77. }
  78. public function addBillDetachedPayment(BillPayment $billDetachedPayment): self
  79. {
  80. if (!$this->billDetachedPayments->contains($billDetachedPayment)) {
  81. $this->billDetachedPayments[] = $billDetachedPayment;
  82. $billDetachedPayment->setAccessBilling($this);
  83. }
  84. return $this;
  85. }
  86. public function removeBillDetachedPayment(BillPayment $billDetachedPayment): self
  87. {
  88. if ($this->billDetachedPayments->removeElement($billDetachedPayment)) {
  89. // set the owning side to null (unless already changed)
  90. if ($billDetachedPayment->getAccessBilling() === $this) {
  91. $billDetachedPayment->setAccessBilling(null);
  92. }
  93. }
  94. return $this;
  95. }
  96. /**
  97. * @return Collection<int, BillDebitBalance>
  98. */
  99. public function getBillDebitBalances(): Collection
  100. {
  101. return $this->billDebitBalances;
  102. }
  103. public function addBillDebitBalance(BillDebitBalance $billDebitBalance): self
  104. {
  105. if (!$this->billDebitBalances->contains($billDebitBalance)) {
  106. $this->billDebitBalances[] = $billDebitBalance;
  107. $billDebitBalance->setAccessBilling($this);
  108. }
  109. return $this;
  110. }
  111. public function removeBillDebitBalance(BillDebitBalance $billDebitBalance): self
  112. {
  113. if ($this->billDebitBalances->removeElement($billDebitBalance)) {
  114. // set the owning side to null (unless already changed)
  115. if ($billDebitBalance->getAccessBilling() === $this) {
  116. $billDebitBalance->setAccessBilling(null);
  117. }
  118. }
  119. return $this;
  120. }
  121. /**
  122. * @return Collection<int, BillPayment>
  123. */
  124. public function getAccountBalanceReimbursements(): Collection
  125. {
  126. return $this->accountBalanceReimbursements;
  127. }
  128. public function addAccountBalanceReimbursement(BillPayment $accountBalanceReimbursement): self
  129. {
  130. if (!$this->accountBalanceReimbursements->contains($accountBalanceReimbursement)) {
  131. $this->accountBalanceReimbursements[] = $accountBalanceReimbursement;
  132. $accountBalanceReimbursement->setAccessBillingAccountBalanceReimbursement($this);
  133. }
  134. return $this;
  135. }
  136. public function removeAccountBalanceReimbursement(BillPayment $accountBalanceReimbursement): self
  137. {
  138. if ($this->accountBalanceReimbursements->removeElement($accountBalanceReimbursement)) {
  139. // set the owning side to null (unless already changed)
  140. if ($accountBalanceReimbursement->getAccessBillingAccountBalanceReimbursement() === $this) {
  141. $accountBalanceReimbursement->setAccessBillingAccountBalanceReimbursement(null);
  142. }
  143. }
  144. return $this;
  145. }
  146. public function getAccess(): ?Access
  147. {
  148. return $this->access;
  149. }
  150. public function setAccess(?Access $access): self
  151. {
  152. $this->access = $access;
  153. return $this;
  154. }
  155. public function getBillSchedule(): BillSchedule
  156. {
  157. return $this->billSchedule;
  158. }
  159. public function setBillSchedule(BillSchedule $billSchedule): self
  160. {
  161. $this->billSchedule = $billSchedule;
  162. return $this;
  163. }
  164. }