SddRegie.php 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. <?php
  2. declare(strict_types=1);
  3. namespace App\Entity\Billing;
  4. // use DH\Auditor\Provider\Doctrine\Auditing\Annotation\Auditable;
  5. use ApiPlatform\Metadata\ApiResource;
  6. use App\Entity\Core\File;
  7. use Doctrine\Common\Collections\ArrayCollection;
  8. use Doctrine\Common\Collections\Collection;
  9. use Doctrine\ORM\Mapping as ORM;
  10. /**
  11. * Classe ... qui ...
  12. * // TODO: possible factoriser avec SddBank?
  13. */
  14. // #[Auditable]
  15. #[ApiResource(operations: [])]
  16. #[ORM\Entity]
  17. class SddRegie
  18. {
  19. #[ORM\Id]
  20. #[ORM\Column]
  21. #[ORM\GeneratedValue]
  22. private ?int $id = null;
  23. #[ORM\OneToMany(mappedBy: 'sddRegie', targetEntity: BillPayment::class, cascade: [], orphanRemoval: false)]
  24. protected Collection $billPayments;
  25. #[ORM\OneToOne(targetEntity: File::class, cascade: ['persist'])]
  26. protected File $file;
  27. #[ORM\OneToOne(targetEntity: File::class, cascade: ['persist'])]
  28. protected File $bordereau;
  29. public function __construct()
  30. {
  31. $this->billPayments = new ArrayCollection();
  32. }
  33. public function getId(): ?int
  34. {
  35. return $this->id;
  36. }
  37. public function getBillPayments(): Collection
  38. {
  39. return $this->billPayments;
  40. }
  41. public function addBillPayment(BillPayment $billPayment): self
  42. {
  43. if (!$this->billPayments->contains($billPayment)) {
  44. $this->billPayments[] = $billPayment;
  45. $billPayment->setSddRegie($this);
  46. }
  47. return $this;
  48. }
  49. public function removeBillPayment(BillPayment $billPayment): self
  50. {
  51. if ($this->billPayments->removeElement($billPayment)) {
  52. // $billPayment->setSddBank(null); // TODO: actuellement, pas nullable: conserver?
  53. }
  54. return $this;
  55. }
  56. public function getFile(): File
  57. {
  58. return $this->file;
  59. }
  60. public function setFile(File $file): self
  61. {
  62. $this->file = $file;
  63. return $this;
  64. }
  65. public function getBordereau(): File
  66. {
  67. return $this->bordereau;
  68. }
  69. public function setBordereau(File $bordereau): self
  70. {
  71. $this->bordereau = $bordereau;
  72. return $this;
  73. }
  74. }