BillPayment.php 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  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 BillAccounting $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 $tags;
  37. public function __construct()
  38. {
  39. $this->billDebitBalances = new ArrayCollection();
  40. $this->tags = new ArrayCollection();
  41. }
  42. public function getId(): ?int
  43. {
  44. return $this->id;
  45. }
  46. public function getBill(): ?BillAccounting
  47. {
  48. return $this->bill;
  49. }
  50. public function setBill(?BillAccounting $bill): self
  51. {
  52. $this->bill = $bill;
  53. return $this;
  54. }
  55. public function getAccessBilling(): ?AccessBilling
  56. {
  57. return $this->accessBilling;
  58. }
  59. public function setAccessBilling(?AccessBilling $accessBilling): self
  60. {
  61. $this->accessBilling = $accessBilling;
  62. return $this;
  63. }
  64. /**
  65. * @return Collection<int, BillDebitBalance>
  66. */
  67. public function getBillDebitBalances(): Collection
  68. {
  69. return $this->billDebitBalances;
  70. }
  71. public function addBillDebitBalance(BillDebitBalance $billDebitBalance): self
  72. {
  73. if (!$this->billDebitBalances->contains($billDebitBalance)) {
  74. $this->billDebitBalances[] = $billDebitBalance;
  75. $billDebitBalance->setBillPayment($this);
  76. }
  77. return $this;
  78. }
  79. public function removeBillDebitBalance(BillDebitBalance $billDebitBalance): self
  80. {
  81. if ($this->billDebitBalances->removeElement($billDebitBalance)) {
  82. // set the owning side to null (unless already changed)
  83. if ($billDebitBalance->getBillPayment() === $this) {
  84. $billDebitBalance->setBillPayment(null);
  85. }
  86. }
  87. return $this;
  88. }
  89. public function getAccessBillingAccountBalanceReimbursement(): ?AccessBilling
  90. {
  91. return $this->accessBillingAccountBalanceReimbursement;
  92. }
  93. public function setAccessBillingAccountBalanceReimbursement(?AccessBilling $accessBillingAccountBalanceReimbursement): self
  94. {
  95. $this->accessBillingAccountBalanceReimbursement = $accessBillingAccountBalanceReimbursement;
  96. return $this;
  97. }
  98. /**
  99. * @return Collection<int, Tagg>
  100. */
  101. public function getTags(): Collection
  102. {
  103. return $this->tags;
  104. }
  105. public function addTag(Tagg $tag): self
  106. {
  107. if (!$this->tags->contains($tag)) {
  108. $this->tags[] = $tag;
  109. }
  110. return $this;
  111. }
  112. public function removeTag(Tagg $tag): self
  113. {
  114. $this->tags->removeElement($tag);
  115. return $this;
  116. }
  117. }