BillAccounting.php 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288
  1. <?php
  2. declare (strict_types=1);
  3. namespace App\Entity\Billing;
  4. use ApiPlatform\Metadata\Get;
  5. use ApiPlatform\Metadata\ApiResource;
  6. use App\Entity\Core\Tagg;
  7. use App\Entity\Organization\Organization;
  8. //use DH\Auditor\Provider\Doctrine\Auditing\Annotation\Auditable;
  9. use Doctrine\Common\Collections\ArrayCollection;
  10. use Doctrine\ORM\Mapping as ORM;
  11. use Doctrine\Common\Collections\Collection;
  12. /**
  13. * @todo : A la suite de la migration, il faut supprimer le nom de la table pour avoir une table BillAccounting, et supprimer l'attribut discr.
  14. * Classe ... qui ...
  15. */
  16. #[ApiResource(operations: [])]
  17. //#[Auditable]
  18. #[ORM\Entity]
  19. class BillAccounting
  20. {
  21. #[ORM\Id]
  22. #[ORM\Column]
  23. #[ORM\GeneratedValue]
  24. protected ?int $id = null;
  25. #[ORM\Column(length: 255, nullable: false)]
  26. protected string $discr = 'billaccounting';
  27. #[ORM\ManyToOne]
  28. #[ORM\JoinColumn(nullable: true)]
  29. protected Organization $organization;
  30. #[ORM\OneToMany(mappedBy: 'bill', targetEntity: BillLine::class, cascade: ['persist'], orphanRemoval: true)]
  31. protected Collection $billLines;
  32. #[ORM\OneToMany(mappedBy: 'bill', targetEntity: BillCredit::class, cascade: ['persist'], orphanRemoval: true)]
  33. protected Collection $billCredits;
  34. #[ORM\OneToMany(mappedBy: 'bill', targetEntity: BillPayment::class, cascade: ['persist'], orphanRemoval: true)]
  35. protected Collection $billPayments;
  36. #[ORM\ManyToOne(inversedBy: 'billCredits')]
  37. #[ORM\JoinColumn(nullable: true)]
  38. protected BillAccounting $bill;
  39. #[ORM\OneToMany(mappedBy: 'bill', targetEntity: BillingIntangibleExcludeDate::class, cascade: ['persist'], orphanRemoval: true)]
  40. protected Collection $billingIntangibleExcludeDates;
  41. #[ORM\ManyToOne(cascade: ['persist'], inversedBy: 'bills')]
  42. #[ORM\JoinColumn(nullable: true)]
  43. protected Pes $pes;
  44. #[ORM\ManyToOne(cascade: ['persist'], inversedBy: 'bills')]
  45. #[ORM\JoinColumn(nullable: true)]
  46. protected BergerLevrault $bergerLevrault;
  47. #[ORM\ManyToOne(cascade: ['persist'], inversedBy: 'bills')]
  48. #[ORM\JoinColumn(nullable: true)]
  49. protected Ciril $ciril;
  50. #[ORM\ManyToOne(cascade: ['persist'], inversedBy: 'bills')]
  51. #[ORM\JoinColumn(nullable: true)]
  52. protected Jvs $jvs;
  53. #[ORM\ManyToMany(targetEntity: Tagg::class, inversedBy: 'billAccountings', cascade: ['persist'])]
  54. #[ORM\JoinTable(name: 'tag_billAccounting')]
  55. #[ORM\JoinColumn(name: 'billAccounting_id', referencedColumnName: 'id')]
  56. #[ORM\InverseJoinColumn(name: 'tag_id', referencedColumnName: 'id')]
  57. protected Collection $tags;
  58. public function __construct()
  59. {
  60. $this->billLines = new ArrayCollection();
  61. $this->billCredits = new ArrayCollection();
  62. $this->billPayments = new ArrayCollection();
  63. $this->billingIntangibleExcludeDates = new ArrayCollection();
  64. $this->tags = new ArrayCollection();
  65. }
  66. public function getId(): ?int
  67. {
  68. return $this->id;
  69. }
  70. public function getOrganization(): ?Organization
  71. {
  72. return $this->organization;
  73. }
  74. public function setOrganization(?Organization $organization): self
  75. {
  76. $this->organization = $organization;
  77. return $this;
  78. }
  79. /**
  80. * @return Collection<int, BillLine>
  81. */
  82. public function getBillLines(): Collection
  83. {
  84. return $this->billLines;
  85. }
  86. public function addBillLine(BillLine $billLine): self
  87. {
  88. if (!$this->billLines->contains($billLine)) {
  89. $this->billLines[] = $billLine;
  90. $billLine->setBill($this);
  91. }
  92. return $this;
  93. }
  94. public function removeBillLine(BillLine $billLine): self
  95. {
  96. if ($this->billLines->removeElement($billLine)) {
  97. // set the owning side to null (unless already changed)
  98. if ($billLine->getBill() === $this) {
  99. $billLine->setBill(null);
  100. }
  101. }
  102. return $this;
  103. }
  104. /**
  105. * @return Collection<int, BillCredit>
  106. */
  107. public function getBillCredits(): Collection
  108. {
  109. return $this->billCredits;
  110. }
  111. public function addBillCredit(BillCredit $billCredit): self
  112. {
  113. if (!$this->billCredits->contains($billCredit)) {
  114. $this->billCredits[] = $billCredit;
  115. $billCredit->setBill($this);
  116. }
  117. return $this;
  118. }
  119. public function removeBillCredit(BillCredit $billCredit): self
  120. {
  121. if ($this->billCredits->removeElement($billCredit)) {
  122. // set the owning side to null (unless already changed)
  123. if ($billCredit->getBill() === $this) {
  124. $billCredit->setBill(null);
  125. }
  126. }
  127. return $this;
  128. }
  129. /**
  130. * @return Collection<int, BillPayment>
  131. */
  132. public function getBillPayments(): Collection
  133. {
  134. return $this->billPayments;
  135. }
  136. public function addBillPayment(BillPayment $billPayment): self
  137. {
  138. if (!$this->billPayments->contains($billPayment)) {
  139. $this->billPayments[] = $billPayment;
  140. $billPayment->setBill($this);
  141. }
  142. return $this;
  143. }
  144. public function removeBillPayment(BillPayment $billPayment): self
  145. {
  146. if ($this->billPayments->removeElement($billPayment)) {
  147. // set the owning side to null (unless already changed)
  148. if ($billPayment->getBill() === $this) {
  149. $billPayment->setBill(null);
  150. }
  151. }
  152. return $this;
  153. }
  154. public function getBill(): ?self
  155. {
  156. return $this->bill;
  157. }
  158. public function setBill(?self $bill): self
  159. {
  160. $this->bill = $bill;
  161. return $this;
  162. }
  163. /**
  164. * @return Collection<int, BillingIntangibleExcludeDate>
  165. */
  166. public function getBillingIntangibleExcludeDates(): Collection
  167. {
  168. return $this->billingIntangibleExcludeDates;
  169. }
  170. public function addBillingIntangibleExcludeDate(BillingIntangibleExcludeDate $billingIntangibleExcludeDate): self
  171. {
  172. if (!$this->billingIntangibleExcludeDates->contains($billingIntangibleExcludeDate)) {
  173. $this->billingIntangibleExcludeDates[] = $billingIntangibleExcludeDate;
  174. /** @phpstan-ignore-next-line */
  175. $billingIntangibleExcludeDate->setBill($this);
  176. }
  177. return $this;
  178. }
  179. public function removeBillingIntangibleExcludeDate(BillingIntangibleExcludeDate $billingIntangibleExcludeDate): self
  180. {
  181. if ($this->billingIntangibleExcludeDates->removeElement($billingIntangibleExcludeDate)) {
  182. // set the owning side to null (unless already changed)
  183. if ($billingIntangibleExcludeDate->getBill() === $this) {
  184. $billingIntangibleExcludeDate->setBill(null);
  185. }
  186. }
  187. return $this;
  188. }
  189. public function getPes(): ?Pes
  190. {
  191. return $this->pes;
  192. }
  193. public function setPes(?Pes $pes): self
  194. {
  195. $this->pes = $pes;
  196. return $this;
  197. }
  198. public function getBergerLevrault(): ?BergerLevrault
  199. {
  200. return $this->bergerLevrault;
  201. }
  202. public function setBergerLevrault(?BergerLevrault $bergerLevrault): self
  203. {
  204. $this->bergerLevrault = $bergerLevrault;
  205. return $this;
  206. }
  207. public function getCiril(): ?Ciril
  208. {
  209. return $this->ciril;
  210. }
  211. public function setCiril(?Ciril $ciril): self
  212. {
  213. $this->ciril = $ciril;
  214. return $this;
  215. }
  216. public function getJvs(): ?Jvs
  217. {
  218. return $this->jvs;
  219. }
  220. public function setJvs(?Jvs $jvs): self
  221. {
  222. $this->jvs = $jvs;
  223. return $this;
  224. }
  225. /**
  226. * @return Collection<int, Tagg>
  227. */
  228. public function getTags(): Collection
  229. {
  230. return $this->tags;
  231. }
  232. public function addTag(Tagg $tag): self
  233. {
  234. if (!$this->tags->contains($tag)) {
  235. $this->tags[] = $tag;
  236. }
  237. return $this;
  238. }
  239. public function removeTag(Tagg $tag): self
  240. {
  241. $this->tags->removeElement($tag);
  242. return $this;
  243. }
  244. }